1

I have webpage for my company with user name password protected.
Now I want to open that webpage on specific computers those I allow, even internet is active on that computer.
I am using asp.net 4.0 with c#.
Is there any one help me that i can allow only specific computers to open that webpage otherwise it will generate error.
Anyone Help Plz !

शेखर
  • 17,412
  • 13
  • 61
  • 117
user2024024
  • 211
  • 1
  • 4
  • 12

2 Answers2

0

Create a whitelist of ip of allowed computer.

in global.asax match the ip with the ip in your list.

If ip is not in the list redirect to error page else continue.

For above method the ip need to be static. If this is not possible then follow this method. Create a page in your website for loggingin...

give the url to only users/computer to which you want to activate.

when the authentication occurs and successfull write a cookie.

delete you newly created page.

again in your global.asax search for this cookie value .

if value is found then ok else redirect to error page.

You must set your cookie value like 180 days so that you dont need to reactivate your 2nd login page.

however if possible use 1st method only.

Ratna
  • 2,289
  • 3
  • 26
  • 50
0

As you application require user name and password to open it.
As all the request goes first to gloabal file as follows

 void Application_Start(object sender, EventArgs e) 
 {
    // Code that runs on application startup
    string localAddress = Context.Request.ServerVariables["LOCAL_ADDR"];
    // Returns "::1" when running under the VS server, however it throws an 
     // exception under IIS Express, so I assume it also does so under IIS.
  }

Create a list anywhere and keep the ip's list which is allowed.
If it is one of those then allow it.
Other wise deny the request.


Here is good link if you have a range define
How to check a input IP fall in a specific IP range

Community
  • 1
  • 1
शेखर
  • 17,412
  • 13
  • 61
  • 117