VS 2005 Web Application Login Controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have set up an application which requires forms autentication using Login
control. Once logged in, there are three pages that user could navigate to.

How do I prevent access to those three pages if the user is not logged in?

Thanks in advance
 
It is up to you to permit/refuse access to each page.

Typically, set a cookie or session variable to indicate that the user is
authenticated and test for that cookie/session variable in the page_load
event of each page

<snip from login form>
If loginok then
session("userauthenticated")=true
endif
</snip>

<snip from all other pages>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Session("Authenticated") Then
Server.Transfer("login.aspx")

End If
End Sub
</snip>

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top