My MembershipProvider control is using the ASP.NET
FormsAuthentication.RedirectToLoginPage();
function to ensure that the user is logged in. This function is great, since it automatically queries for the login (on the login page), and redirects back to the original page after the login has taken place.
To set this up in umbraco, I had to take the following steps:
1. Edit the web.config file to set the authentication mode settings correctly:
<authentication mode="Forms">
<forms name="LPSEC" loginUrl="~/login,aspx" path="/" timeout="30" slidingExpiration="true" cookieless="AutoDetect" protection="All" requireSSL="true" defaultUrl="~/UserInformation.aspx" />
</authentication>
Since I've already setup my HTTPS redirection, this should work.. I think... but I just get a weird error... Time to ask the forum again...
Figuring out this one, I have also learned that umbraco basically always renders default.aspx page, but it replaces the URL. When the RedirectToLoginPage() is called, the destination page (login.aspx in my case) is correctly specified in the URL, but due to umbraco, the source page (which the login page will return to when done), is added in the URL like this:
https://<my domain>/restricted/login.aspx?ReturnUrl=%2fdefault.aspx%3fumbPage%3d%2fsolutions.aspx
Because the return page includes the parameter umbPage (which umbraco needs to specify ANY page really, since they're all essentially default.aspx behind the scenes), I believe that umbraco misinterprets the login URL above, and things that because it contains umbPage, it should REALLY redirect to the solutions.aspx page. However, somehow umbraco messes up the parameters and tried to look for a non-existing node (where it shouldn't look at all).
The solution (Thank you Paul), is that FormsAuthentication.RedirectToLoginPage() does not work with umbraco. Instead I have to write my own redirection code (Read the details in my forum post here).
While umbraco has the promise of ease of use, my simple little website conversion from ASP.NET to umbraco is turning out to have a tweak at every intersection. I'm beginning to have my doubts about this whole endeavor...