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
How to do that my doubt?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
SenthilkumarRank #387 · 6.5K pointsPosted Mar 30, 2012, 7:58 PM EDT
You need to store your laptop IP address some where in the web.config or constant.
When ever the request comes from the url then you need to get the IP address of the request URL.
You need to check whether the request IP address is same one which stored in the web.config. It it is equal then its your laptop and if not then you need to show it login fail.
To get the IP address of requested url is:
string strIPAddress = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList.GetValue(0).ToString();
This logic can be written in your base page or global.asax page.
Hope this will help you.
magesh manavalanRank #7,614 · 236 pointsPosted Mar 30, 2012, 8:09 PM EDT
magesh manavalanRank #7,614 · 236 pointsPosted Mar 30, 2012, 8:11 PM EDT
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="myDbConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\myDb.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<appSettings/>
<system.web>
<authentication mode="Forms">
<forms loginUrl="Login.aspx"/>
</authentication>
<compilation debug="true" targetFramework="4.0"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<!--SECURING PAGE OR DIRECTORY TO ANONYMOUS ACCESS HERE-->
<location path="securepage">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</configuration>