Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP protected pages 1

Status
Not open for further replies.

giahan

Programmer
Sep 1, 2000
139
US
Hi all,

I have to set up a couple pages that only allow user who has entered password and Id. How do I do it in ASP?
I know that I have to have a login screen, but have no ideas that how to passing permission thru pages

Thnks.

GH
 
Firstly you should decide how secure you wish your pages to be. If you require a low level of security and have only a few users using a statement like:

If Request("username") = whateva AND Request ("password") = whateva Then
Response.Redirect yourpage.htm
End If

May be ok. However for extra security and if you have a large number of users you may wish to use a database connection to verify user details in which case something like the code outlined in this article should be used:


There are also heaps of other good asp related websites that may have answers to this question (asphole.com)

Justin
 
I would like to add that you can use session parameters to pass permission through pages:

If Request("username") = whateva AND Request ("password") = whateva Then
Session("Authenticated") = 1
Response.Redirect yourpage.htm
End If

Then, in every protected page, place the following code:

OK = Session("Authenticated")
If IsEmpty(OK) Then
Response.Redirect login.htm
End If

Hope this helps...

<webguru>iqof188</webguru>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top