11 03 2013

How To Build Responsive Web Design

Responsive design is a skill for developing the next generation of muiti-device applications and websites.
There is a great article on responsive designat foloowing link,

https://www.simple-talk.com/dotnet/asp.net/responsive-design-using-foundation-with-asp.net-mvc/



11 01 2013

How to fix rewrite rule for excluding media content folder

rule name="ModX IIS7 Rule 2" stopProcessing="true">
             match url="^(wp-content)" ignoreCase="false" />              
                           action type="None"
                       
       

add this rule script into your web.config for except media content

20 12 2012

How to Fix Windows 8 store install pending problem


for troubleshooting (press win+w >then type troubleshooting).

click -fix problems with windows updates-
click next.
when windows ask  you want to try in administrator mode, click -yes-
and windows will find problem and solve the problem.

10 12 2012

Installing Virtaual Linux using Hyper-V and Linux Integration Services


Example for CENTOS 6.3

1 - Download LIC 3.4
2- Connect your Virtual machine
3- as root user, mount /dev/cdrom /media
4- chmod 777 /media
5- cd /media
6- cd RHEL63  (or whatever your os system version exist, for centos6.3 choose RHEL63)
7- ./install.sh

This also is a solution for "Failed dependencies" problem !
problem described as "is needed by kmod-microsoft-hyper-v- ...."
 LIC 3.4 is a MUST package to fix it !

And final result ; :)





05 12 2012

C# ASP.NET ConfigHelper

//Read Write app.config

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;


    public sealed class ConfigHelper
    {
        public static string GetValue(string key)
        {
            return ConfigurationManager.AppSettings[key];
        }


        public static void SetValue(string key, string value)
        {
            System.Configuration.Configuration config =
             ConfigurationManager.OpenExeConfiguration
                        (ConfigurationUserLevel.None);

            config.AppSettings.Settings[key].Value = value;

            config.Save(ConfigurationSaveMode.Full);

            ConfigurationManager.RefreshSection("appSettings");
        }
    }



C# ASP.NET How to send email ?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Mail;
using System.Configuration;

    public sealed class MailHelper
    {
        public static void Send(string toAccount, string subject, string body)
        {
            string fromAccount = ConfigHelper.GetValue("mailAccount");
            string fromPassword = ConfigHelper.GetValue("mailPassword");
            string mailHost = ConfigHelper.GetValue("mailHost");
            int mailPort = Convert.ToInt32(ConfigHelper.GetValue("fromPort"));
            var fromAddress = new MailAddress(fromAccount, fromAccount);
            var toAddress = new MailAddress(toAccount, toAccount);
            var smtp = new SmtpClient
                       {
                           Host = mailHost,
                           Port = mailPort,
                           EnableSsl = true,
                           DeliveryMethod = SmtpDeliveryMethod.Network,
                           UseDefaultCredentials = false,
                           Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
                       };
            using (var message = new MailMessage(fromAddress, toAddress)
                                 {
                                     Subject = subject,
                                     Body = body
                                 })
            {
                smtp.Send(message);
            }
        }
    }

03 12 2012

C# READ MAC ADDRESS



public static string GetMacAddress()
        {
            string macAddresses = string.Empty;
            foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
            {
                // ignore any loopback device
                if (nic.NetworkInterfaceType != NetworkInterfaceType.Ethernet) continue;
                if (nic.OperationalStatus == OperationalStatus.Up)
                {
                    macAddresses += nic.GetPhysicalAddress().ToString();
                    break;
                }
            }
            return macAddresses;
        }

Share It