Changing the IP address of the server using asp net
Changing the IP address of the computer automatically is very easy. Microsoft trickily stores the IP information in registry. Refer the below code that changes the IP address of the host server. This can be used in windows application or windows services to change the IP address of the local computer and can also be used in asp.net to change the IP address of the server that hosts your asp.net application. Make sure that Microsoft.Win32 namespace is visible to the below code wherever it is placed because Win32 is needed for manipulating Windows registry. Server restart is needed for new IP addresses to come into the effect.
RegistryKey key = Registry.LocalMachine.OpenSubKey(“SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces”, true);
// Registry key where IP information is stored.
foreach (string s in key.GetSubKeyNames())
{
RegistryKey rk = Registry.LocalMachine.OpenSubKey(“SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\” + s, true);
if (rk.ValueCount >= 12) // In general, active network card will have more than 12 setting values
{
try
{
string[] s1 = { “12.24.36.48″, “13.26.39.64″ }; // Array of IP addresses to set.
rk.SetValue(“IPAddress”, s1);
}
catch (Exception exc)
{
// Error message logic here.
}
}
rk.Close();
}
NOTE: Do not use this code uniethically. Cool
Moreover, it requires Full Trust level enabled for the ASP.NET website to run above code, otherwise security exception will occur.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.
Exception Details: System.Security.SecurityException: Requested registry access is not allowed.


ankur kumar sinha
i am new in his field please guide me through mail.i am thankful to u.