Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Membership stuff acts wierd on production server

Reply
Thread Tools

Membership stuff acts wierd on production server

 
 
Bobby Edward
Guest
Posts: n/a
 
      10-21-2008
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.


 
Reply With Quote
 
 
 
 
Jason James
Guest
Posts: n/a
 
      10-21-2008
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.
 
Reply With Quote
 
 
 
 
Bobby Edward
Guest
Posts: n/a
 
      10-21-2008
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>/<DbProviderFactories> section, but I don't really know how
yet.

Sound right?

Thanks!

"Jason James" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd stuff in an controller David Westerink Ruby 1 10-05-2009 12:03 PM
using Membership on production server (Copy Web Site tool) - Used to SQL Server 2000 enterprise edition Louis R. ASP .Net 5 01-14-2009 06:21 AM
using Membership on production server (Copy Web Site tool) Louis R. ASP .Net 3 12-09-2008 08:43 PM
RPC Client acts like a server Utku Altinkaya Python 0 07-14-2008 10:15 AM
Membership users not available on production server from development machine microteq ASP .Net Security 0 07-26-2007 07:46 AM



Advertisments