I am developing one application. i want run only in my laptop. suppose i give to another persons means will change current IP Address then only run otherwise will not be run and it will show the login fail how to do that.
please send me with Example.
Thanks&Regs
Magesh.A
Loading
brunda kPosted Mar 30, 2012, 5:32 AM
magesh manavalanPosted Mar 30, 2012, 5:19 AM
brunda kPosted Mar 30, 2012, 5:09 AM
magesh manavalanPosted Mar 30, 2012, 4:59 AM
brunda kPosted Mar 30, 2012, 4:54 AM
{
context.BeginRequest += new EventHandler(Application_BeginRequest);
}
private void Application_BeginRequest(object source, EventArgs e)
{
HttpContext context = ((HttpApplication)source).Context;
string ipAddress = context.Request.UserHostAddress;
if (!IsValidIpAddress(ipAddress))
{
context.Response.StatusCode = 403; // (Forbidden)
}
}
private bool IsValidIpAddress(string ipAddress)
{
return (ipAddress == "127.0.0.1");
}
Hope the above code is bit clear and useful.
magesh manavalanPosted Mar 30, 2012, 4:18 AM
brunda kPosted Mar 30, 2012, 4:02 AM