Author: skyw | Posted on: 5/12/2009 12:34:35 AM | Views : 521

 Hi,
I am using the System.net namespace methods to get the IP of the server programmatically.

            IPHostEntry ipEntry = Dns.GetHostEntry(Dns.GetHostName());
            IPAddress[] addr = ipEntry.AddressList;
            string strList = "";
            strList = addr[0].ToString();

The first line of the above code results in - 
An exception of type 'System.Security.SecurityException' occurred in mscorlib.dll but was not handled in user code Additional information: Request for the permission of type 'System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089& ...

Go to the complete details ...