404 Error when changing password, etc

Jul 18, 2009 at 11:19 PM

I am running BE.NET (1.5.0.7) connected to a sql 05 db.

I get a 404 error whenever I try to delete a blogroll, change a password, create a user, etc.

What could be the cause of this?

Coordinator
Jul 18, 2009 at 11:52 PM

By default, if an unhandled error occurs, you'll be redirected to the error404.aspx page.  If that's what's happening, then changing the <customErrors> tag in your web.config file to the following tag will show you the actual error instead of redirecting you to error404.apsx.

<customErrors mode="Off">

Jul 19, 2009 at 12:24 AM

that seems backwards, but I will give it a shot on Monday.  How come it doesn't do a 500 error instead.  I think this could wreak havoc on a site's search engine rankings if it showed 404 errors during an outage instead of the 500 errors.

Jul 19, 2009 at 12:25 AM

But thank you for the quick and insightful response.  It is greatly appreciated!

Coordinator
Jul 19, 2009 at 12:40 AM

I agree that the redirect to error404.aspx is confusing.

Actually, in one of the more recent builds (changeset 27919 released on June 13th), it works differently now.  The same <customErrors> tags is still there, but it's not really used anymore since there is now an unhandled exception handler in the Global.asax file.  It catches these 500 errors and displays the error details on a new error.aspx page (if you're logged in).

I blogged about this change in behavior ...
http://allben.net/post/2009/06/13/Logging-Improved-Error-Reporting-in-BlogEngine.aspx

Jul 19, 2009 at 1:49 AM

ok, so the error indicates the role/memebership could not access the xml file.  Odd, I thought I had made that SQL.  I went into the web.config, changed the default provider to sql, and now I get a error stating a stored procedure could not be found (part of the ASPNETDB).  I do not want to use the ASPNETDB if I can avoid it, and would prefer to use the users/roles tables in BlogEngine.net.

what now?  I tried looking up the error, and I came across a post that said if I wanted to use the BE db for this, I had to set the provider to a LINQ provider, but it did not show any details.

Could you post a sample web.config for this configuration, sans uid/pw, so I see what I am missing?

Coordinator
Jul 19, 2009 at 5:22 AM

The web.config file that comes with BE 1.5 is at:

http://blogengine.codeplex.com/SourceControl/changeset/view/26780#18456

To store users/roles in the BE DB tables (be_Users and be_Roles), just change the "defaultProvider" for <membership> and for <roleManager> to DbMembershipProvider and DbRoleProvider respectively (changes shown below in bold).

Both of those providers have a "connectionStringName" attribute.  They're set for "BlogEngine".  So you just want to make sure you have a connection string in the web.config file name "BlogEngine" that points to your DB.

<membership defaultProvider="DbMembershipProvider">
    <providers>
        <clear/>
        <add name="XmlMembershipProvider" type="BlogEngine.Core.Providers.XmlMembershipProvider, BlogEngine.Core" description="XML membership provider" passwordFormat="Hashed"/>
        <add name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
        <add name="DbMembershipProvider" type="BlogEngine.Core.Providers.DbMembershipProvider, BlogEngine.Core" passwordFormat="Hashed" connectionStringName="BlogEngine"/>
    </providers>
</membership>

<roleManager defaultProvider="DbRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".BLOGENGINEROLES">
    <providers>
        <clear/>
        <add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core" description="XML role provider"/>
        <add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
        <add name="DbRoleProvider" type="BlogEngine.Core.Providers.DbRoleProvider, BlogEngine.Core" connectionStringName="BlogEngine"/>
    </providers>
</roleManager>

Jul 19, 2009 at 6:45 AM

that did the trick, thanks!