ASp.net 2.0 Authentication

G

Guest

Hi,

I'm using asp.net 2.0 authentication with sql server 2005. I have also roles
and I'd like to authenticate a user and then send them to specific page
depending on roles.
This is what I'm using:

If Membership.ValidateUser(TextBox1.Text, TextBox2.Text) Then
FormsAuthentication.SetAuthCookie(CStr(TextBox1.Text), False)



If Context.User.IsInRole("Parents") Then

Response.Redirect("AppsHtml/Roles/Parents.aspx", True)

End If



Else

Label3.Visible = True


End If

The problem is that when I run the application to try, I fill Login and
pass, I press the button but nothing happens. When I press the button a
second time then I get redirected to the correct page.

I have also a web.config file with locations:

<location path="AppsHtml/Roles/Parents.aspx>
.....
<allow roles="Parents"/>
<deny users="*"/>
.....


Any Idea of what I'm doing wrong?

Thanks

Juan Puebla
 
D

Daniel Fisher\(lennybacon\)

Understand that your sends the Cookie to the client using a header in HTTP -
you need to do a roundtrip before you can request values from the cookie.
 

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

Top