Connecting Tech Pros Worldwide Forums | Help | Site Map

Restrict the access to a particular website

Newbie
 
Join Date: Jul 2008
Posts: 28
#1: Jul 21 '08
hi,

I had created a web application in c#. It is uploaded and going smoothly. Now the request of the client is to restrict the access of their site. They want access only in some machines(Not in world wide). The restriction cannot be done by using IP address.

I have a logic to implement this. Create a particular folder in all the client machines. Then check for this particular folders existance during run time. If the folder exists then only the client can access the site.

I had created a folder inside the WINDOWS\System32 and check for its existance. It is running smoothly in my machine. But after uploading if can't read the directory. I don't know why it happens so.

I was created the folder by using the following command

md %windir%\System32\MyFolder

I am checking the existance of the folder by using the following code

If(Directory.Exists(@"%windir%\System32\MyFolder")
{
Response.Redirect("LoginPage.aspx");
}

I don't know whether there is any need to set the access permission such as read and write

if u have any idea please share

Thanks
Grace

insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#2: Jul 21 '08

re: Restrict the access to a particular website


Quote:

Originally Posted by gracepaul

I had created a folder inside the WINDOWS\System32 and check for its existance. It is running smoothly in my machine. But after uploading if can't read the directory. I don't know why it happens so.

This is because ASP.NET doesn't interact with the client computer, only the server. When you were debugging on your local machine, you had access to that folder because your local machine was acting as the server. Once you uploaded the website, the website started looking on the webserver for that folder, which doesn't exist.

ASP.NET is server-side. You can't access the client's filesystem. This approach will not work. I suggest you look at authentication and user logins.
Newbie
 
Join Date: Jul 2008
Posts: 28
#3: Jul 25 '08

re: Restrict the access to a particular website


hi all,

can we use the dynamic ip address to identify a paticular computer on the internet .
is there a static ip address for a computer which have dynamic ip to connect to the internet
is an internet connection provider provides both static ip and dynamic ip to a computer

my need is to save the internet ip in the database and check while the user login to my website. if the ip address at the time of login and the ip address i the database are same then he can easily login. it works well with static ip addresses. but when dynamic ip is there then the ip is changing time to time. so i cannot keep it in my database

i am workig in vb.net and my aim to block the unwanted access to my website

please help as early as possible

thanks
grace
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#4: Jul 25 '08

re: Restrict the access to a particular website


Dynamic IP is dynamic...there's no better way of explaining it. It could change at any time, and there is nothing you can do to track it. Once my IP has changed, it's changed, and there is nothing linking me to the old one again.
kenobewan's Avatar
Moderator
 
Join Date: Dec 2006
Posts: 4,745
#5: Jul 25 '08

re: Restrict the access to a particular website


Please stop mulitiposting, it is against site rules - see Posting Guidelines. I've also noted your one in IIS.
TRScheel's Avatar
Expert
 
Join Date: Apr 2007
Location: Iowa
Posts: 624
#6: Jul 25 '08

re: Restrict the access to a particular website


Your best bet is to set up a login page tied to a database. Another solution, no where near on par with the login page solution, is to have a common password that is required to access the page(s).
Reply