How to get BlogEngine.Net 1.4.5 authenticating with parent web application?

Topics: ASP.NET 2.0, Themes
Mar 6, 2009 at 10:26 AM
Hi there,
I've used the guide from this discussion to implement BlogEngine.Net 1.4.5 as a web application, and have deployed it to my server as an application in a virtual directory under my ASP.Net MVC website.
i.e. if my website is http://www.example.com, BE is deployed under http://www.example.com/blog

As part of the user experience, I wanted users to login to my main application and also be able to log in to BE.
Following this guide on MSDN I copied the MachineKey settings in web.config from the parent application to BE's web.config.

However this has not had the desired effect, as when I restarted IIS and browsed the main site, logged in, then went to the blog, the authentication didn't carry forward (as it showed me that I wasn't logged in).

Additionally, to stop the web.config from the parent application being used in BE, I edited the parent application's web.config to have the line
<location path="." inheritInChildApplications="false">
with all my application specific settings inside there...This seems to have been disabled, as the theming for BE.Net no longer works.

Using Firebug, it shows that the following when the CSS line is expanded that indicates there was an error finding the CSS handler:
<link type="text/css" href="/blog/themes/myTheme/css.axd?name=style.css&v=1.4.5.0" rel="stylesheet">
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<title>IIS 7.0 Detailed Error - 404.0 - Not Found</title>
5<style type="text/css">

Can anyone offer some help here on where I should start looking to troubleshoot?
-Nissan
Coordinator
Mar 6, 2009 at 4:11 PM
Edited Mar 6, 2009 at 4:19 PM
Did the CSS handler stop working when you added inheritInChildApplications="false"?

In your BE's web.config file, what lines do you have related to css.axd?  Do you have a <system.webServer> section in your web.config file?  If not, try adding the one I posted here in your web.config file.  It would go right before the closing </configuration> tag at the bottom of the web.config file.  If you do already have a <system.webServer> section, then try replacing the one you have with that one I posted.

Regarding authenticating people in the parent application, at that MSDN link, in the "Sharing Authentication Tickets Across Applications" section, they talk about using common validationKey and decryptionKey values between the applications.  Did you do that?

Also, the cookie name is important.  By default, BE uses ".AUXBLOGENGINE" for its forms authentication cookie name.  You can see this in BE's web.config file.  I think you will need to use the same cookie name between your parent application and the BE application.

Another cookie that BE uses is the "roles" cookie, which by default is ".BLOGENGINEROLES".  This too is in the web.config file.  This may need to match what you have in your parent application ... although you may not be using roles or may have different roles in the parent application ... so without testing, I'm not sure about this.  If this becomes a problem, you could try changing "cacheRolesInCookie" to "false" in the BE web.config file.

EDIT: Also, does the username a person logs in with in the parent application match a username you have setup in the BE application?