ASP.NET Membership: BE doesn't think I am admin

Topics: ASP.NET 2.0
Apr 20, 2009 at 12:33 AM
Hi, guys.

I somehow managed to integrate BlogEngine with existing ASP.NET site (without separate application in IIS). After a few hours of work everything builds up and I fixed all runtime errors.

I can't see links in Administration widget, nothing except "Change password". ASP.NET Membership is working, I can log in and change my password. It seem like BlogEngine thinks I'm not in Administrators role, but I am. Here is the proof:



From web.config:

  <roleManager enabled="true" defaultProvider="CustomizedRoleProvider">
      <providers>
        <add name="CustomizedRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="itinwebsite"/>
      </providers>
    </roleManager>

    <membership defaultProvider="AspNetSqlMembershipProvider">
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" applicationName="itinwebsite"/>
      </providers>
    </membership>

<appSettings>
    <add key="BlogEngine.FileExtension" value=".aspx"/>
    <add key="BlogEngine.VirtualPath" value="~/blog/"/>
    <add key="BlogEngine.MobileDevices" value="(nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)"/>
    <add key="BlogEngine.AdminRole" value="Administrators"/>
    <add key="StorageLocation" value="~/App_Data/"/>
    <add key="BlogEngine.HardMinify" value="blog.js,widget.js,WebResource.axd"/>
  </appSettings>

Am I doing something wrong?

Best regards,
Sergey
Coordinator
Apr 20, 2009 at 4:23 AM
Offhand, I'm not sure the problem.  But was just curious if you can access one of the control panel pages directly ... or if you get kicked out to the login.aspx page.  For example:

http://localhost/blog/admin/Pages/Settings.aspx
Apr 20, 2009 at 7:09 AM
Hello, Ben.

Yes, I can access the page, no problem:

Free Image Hosting at www.ImageShack.us

I can't even find a place in the code where Administration widget checks if it should display the links or not :( Any suggestions where I should start digging?

Best regards,
Sergey
Apr 20, 2009 at 7:10 AM
PS. I have changed theme. No luck, same problem.
Coordinator
Apr 20, 2009 at 5:57 PM
That's good news that you can access the Settings page and other pages too, I presume.  Access to those pages is controlled by the Web.config file in the admin\Pages folder.  Only administrators can access some of those pages like Settings.  So the fact that you can access them is a good sign.

The menu is defined in the Web.sitemap file in the root of the blog.  The code that outputs the menu links is in the menu.ascx.cs file in the admin folder.  So if you put a breakpoint in there and follow the code as it's executing, that should hopefully shed some light on the situation.
Apr 21, 2009 at 12:15 AM
Oh, yeah!

With your help it took me less than 2 minutes to find the problem. Turned out it had nothing to do with membersip provider. I just had to change path to the sitemap in web.config:

<add name="SecuritySiteMap" description="Used for authenticated users." type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" securityTrimmingEnabled="true" siteMapFile="~/blog/Web.sitemap"/>

Thank you so much!
Jul 20, 2010 at 6:13 PM
sergeykovalev can you please post the steps to integrate the blog in existing website using membership control? Thank you!