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
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