0
Answer

Login control + (Membership and Roles) + ('Publish Web Site') = Login Failure!

Ask a question
Al Ghati

Al Ghati

16y
4.2k
1
What I am using:

What I am using:

.NET 2.0; Sql express

Login Control with default provider and  Membership and Roles

Local Database ASPNETDB.mdf in App_Data folder 

Localization tags something like this...

 <location path="administrator"  inheritInChildApplications="true" >
  <system.web>
   <authorization>
    <allow roles="administrator" />
    <deny users="*" />
   </authorization>
  </system.web>
 </location>

What the problem is:
I login using the required Login.aspx and a login control.  It all works great in debug mode!  When I publish the Web site onto the SAME computer in a different virtual directory...I try to login again and it fails. 

Things I have tried:
Detaching and re-attaching at application_start using something like this...
    CREATE DATABASE WebAppDB
         ON (FILENAME = '" + Server.MapPath(@"~\App_Data\ASPNETDB.MDF")
         (FILENAME = '" + Server.MapPath(@"~\App_Data\ASPNETDB_LOG.LDF")
         FOR ATTACH; ;
 
It works but does not fix the problem.

(Yes I've tried renaming the db thus the WebAppDB, it appears in Sql Management Studio as a read-only database.) 

I've tried the using the Authenticate handler of Login control and Membership.ValidateUser to no avail.

I've since taken out my 'fix attempts' so you can rest assured the current issue is the original one.

There must be a quick fix for this that does not involve code access security, impersonation, etc.

Your help is appreciated!