Skip to content

How to do that my doubt?

magesh manavalan

Asked Mar 29, 2012, 8:00 PM EDT3 answers
Share
LinkedInX
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

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Senthilkumar
    0
    Hi,

    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.
    0
  • 0
    This is my Web.Config code. where i will put your code pls tell me.
    0
  • 0
    This is my Web.Config file code. where i will write your code please tell me.

    <?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>
    0