468,133 Members | 1,486 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

Membership stuff acts wierd on production server

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.

Any ideas? Thanks.
Oct 21 '08 #1
2 1370
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;

Response.Write("<p/>TicketName: " + ticket.Name);
Response.Write("<br/>Cookie Path: " + ticket.CookiePath);
Response.Write("<br/>Ticket Expiration: " +
ticket.Expiration.ToString());
Response.Write("<br/>Expired: " + ticket.Expired.ToString());
Response.Write("<br/>Persistent: " +
ticket.IsPersistent.ToString());
Response.Write("<br/>IssueDate: " +
ticket.IssueDate.ToString());
Response.Write("<br/>UserData: " + ticket.UserData);
Response.Write("<br/>Version: " + ticket.Version.ToString());

Hope this is of some use.

Jason.
Oct 21 '08 #2
Thanks Jason.

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

In my web.config I have it setup as this...

<membership defaultProvider="AspNetMySqlMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<remove name="AspNetMySqlMembershipProvider" />
<add name="AspNetMySqlMembershipProvider"
type="CoreLab.MySql.Web.Providers.MySqlMembershipP rovider"
connectionStringName="MySqlServices" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true"
requiresUniqueEmail="true" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" passwordAttemptWindow="10"
description="MyDirect membership provider" applicationName="/AmtekCivCast "
minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" />
<add name="PasswordResetProvider"
type="CoreLab.MySql.Web.Providers.MySqlMembershipP rovider"
connectionStringName="MySqlServices" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
requiresUniqueEmail="true" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" passwordAttemptWindow="10"
description="MyDirect membership provider" applicationName="/AmtekCivCast "
minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" />
</providers>
</membership>
<roleManager defaultProvider="AspNetMySqlRoleProvider" enabled="true"
cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="90"
cookiePath="/" cookieProtection="All">
<providers>
<remove name="AspNetMySqlRoleProvider" />
<add name="AspNetMySqlRoleProvider"
type="CoreLab.MySql.Web.Providers.MySqlRoleProvide r"
connectionStringName="MySqlServices" />
</providers>
</roleManager>
<!--<anonymousIdentification enabled="true"/>-->
<profile defaultProvider="AspNetMySqlProfileProvider">
<providers>
<remove name="AspNetMySqlProfileProvider" />
<add name="AspNetMySqlProfileProvider"
type="CoreLab.MySql.Web.Providers.MySqlProfileProv ider"
connectionStringName="MySqlServices" />
</providers>
<properties>
<!-- <add name="ZipCode" /-->
</properties>
</profile>

I'm thinking that I have to add these entries to the
<system.data>/<DbProviderFactoriessection, but I don't really know how
yet.

Sound right?

Thanks!

"Jason James" <ja***@dive-master.orgwrote in message
news:f1**********************************@q35g2000 hsg.googlegroups.com...
>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;

Response.Write("<p/>TicketName: " + ticket.Name);
Response.Write("<br/>Cookie Path: " + ticket.CookiePath);
Response.Write("<br/>Ticket Expiration: " +
ticket.Expiration.ToString());
Response.Write("<br/>Expired: " + ticket.Expired.ToString());
Response.Write("<br/>Persistent: " +
ticket.IsPersistent.ToString());
Response.Write("<br/>IssueDate: " +
ticket.IssueDate.ToString());
Response.Write("<br/>UserData: " + ticket.UserData);
Response.Write("<br/>Version: " + ticket.Version.ToString());

Hope this is of some use.

Jason.

Oct 21 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by kvr901 | last post: by
3 posts views Thread by ryan.mclean | last post: by
reply views Thread by PinkBishop | last post: by
1 post views Thread by =?Utf-8?B?aGZkZXY=?= | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.