My site is utilizing asp.net membership. It works perfect on the
development machine.
I copied the entire directory to the production server. Now it seems that
the membership stuff is acting wierd.
I can login ok. But it doesn't run the login redirect properly.
Also, I wrote a simple test page that consists of this...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
response.write("DEBUG:")
For Each role As String In Roles.GetAllRoles
Response.Write(role & ";")
Next
If User.IsInRole("Administrator") Then
Response.Write("admin/manageusers.aspx")
ElseIf User.IsInRole("Engineer") Then
Response.Write("engineer/manageprojects.aspx")
ElseIf User.IsInRole("Non-Engineer") Then
Response.Write("membersonly/mycivcast.aspx")
Else
Response.Write("default.aspx")
End If
End Sub
On my local dev machine it spits out all the roles (from the For statement.)
In the production server it doesn't spit out ANY roles, even though the
web.config's both point to the production server mysql db.
I have been recently developing with the membership provider and found
this snippet of code very useful in determining if I was correctly
authenticated as a user. This might give you some insight as to
whether or not you are actuall authenticating correctly. I added it
to my default page and got the login page to redirect me.
FormsIdentity id = (FormsIdentity)User.Identity;
FormsAuthenticationTicket ticket = id.Ticket;
I'm thinking this has to do with the fact that I am using custom
membership/role providers (because I am using CoreLabs MyDirect.NET to
access the MySQL database.)