I'm not sure if I'm missing something but my forms authentication
doesn't work. I'm trying to access my page and I should be redirected to
login.aspx but it just let's me access the page.
Here's my web.config code:
<authenticati on mode="Forms">
<forms name="login" loginUrl="login .aspx" protection="All "
timeout="15" />
</authentication>
<authorizatio n>
<allow users="*" />
<deny users="?" />
</authorization>
My login page takes care of the login information:
Dim sql As String
sql = "SELECT username FROM contacts WHERE username ='" &
txtUsername.Tex t & "' AND password ='" & txtPassword.Tex t & "'"
Dim cn As SqlConnection = New
SqlConnection(C onfigurationSet tings.AppSettin gs("CONN_STRING "))
Dim comm As SqlCommand = New SqlCommand(sql, cn)
comm.Connection .Open()
Dim reader As SqlDataReader =
comm.ExecuteRea der(CommandBeha vior.CloseConne ction)
If reader.Read() Then
FormsAuthentica tion.RedirectFr omLoginPage(txt Username.Text, True)
Else
lblMessage.Text = "Invalid User"
End If
This web config is in the same folder as my web pages so if I should try
to access "page1.aspx ", I should be redirected to login.aspx.
Am I not correct or am I missing something.
Thanks for you help.
Rob
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!