Forum Moderators: open

Message Too Old, No Replies

login requirements

         

Blelisa

3:13 pm on Jun 7, 2005 (gmt 0)

10+ Year Member



Can someone point me to the code or tutorial I need.
I have some pages that I don't want people to access if they are not logged in.
I have it set up so that if you come through my site and you click on downloads, you go to the log in page and then you have to login or register in order to get access, however, I am concerned about someone being able to come in the back way and gain access to my download page.
Can anyone help me?]

Thanks!

Balloon

4:30 pm on Jun 7, 2005 (gmt 0)

10+ Year Member



A simple way to do it would be to do something like this.

When the user enters their username / password, check that it is a valid entry (by looking the information up in the database, for example).

If they are allowed to login, store something in the session to say that the user is logged in...

Session ("UserLoggedIn") = 1

Then - at the top of all of your 'secure' pages, put something like this in the Page_Load event...

If Session ("UserLoggedIn") <> 1 then
call Response.Redirect ("/login.aspx")
End If

Hope that helps,
- Chris