If you are having problems using ASP.NET membership within
Umbraco using IIS7 with use Directory URLs set to true then this
should solve your problems - Some of the issues you will see
are
- Unable to create / login users
- Login status not working
- Membership Methods Returning Null
This is the problem:
Default behaviour for iis7 for the formsauthentication
module is to only invoke for requests to asp.net applications or
managed handlers (probably also for iis6). If you disable the
'Invoke only for requests to ASP.NET applications or managed
handlers' option, forms authentication will work then also for
directory urls.
To solve the problem, do the following: [more]
- Open up IIS Manager
- Select the website you want to alter
- Double click on "Modules"
- Locate the parameter named "FormsAuthentication" and double
click on it
- Uncheck the checkbox "Invoke only for requests to ASP.NET
applications or managed handlers"
- Click OK
This will now solve all the membership problems, apart from one
error - If you try to access a restricted page while NOT logged in,
you'll get an error like this
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.Security.Membership.GetCurrentUserName() +37
System.Web.Security.Membership.GetUser() +7
umbraco.requestHandler..ctor(XmlDocument _umbracoContent, String url) +3493
umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e) +903
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnPreInit(EventArgs e) +8699406
System.Web.UI.Page.PerformPreInit() +31
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282
To stop this happening you need to add the following attribute
'runAllManagedModulesForAllRequests' to the modules tag in the
web.config
<modules runAllManagedModulesForAllRequests="true">
That should be it, everything should now work as it should - I
hope this saves someone else the frustrating amount of hours I
spent trying to figure it out.