i think this may be the network latency issue. so u can invoke above functionlity once on application startup and stores somewhere.. so u dont need to fetch it every time
public static void GetLoginIP()
{
try
{
if(Session["IP"] == null)
{
String strIP = "";
WebRequest request = WebRequest.Create("http://checkip.dyndns.org/");
using (WebResponse response = request.GetResponse())
using (StreamReader stream = new StreamReader(response.GetResponseStream()))
{
strIP = stream.ReadToEnd();
}
int first = strIP.IndexOf("Address: ") + 9;
int last = strIP.LastIndexOf("</body>");
strIP = strIP.Substring(first, last - first);
Session["IP"] = strIP;
}
}
catch(Exception Ex)
{
}
}