When I call HandleFormsLogin it returns '/default.aspx' if the user correctly logs in and null if the user does not.
I have set the system up so that in the authentication section of the web.config the 'login page' is an episerver page e.g. /globalUtilities/login/
When I go to a protected part of the site I correctly get redirected to this page but the ReturnUrl looks wrong e.g.
http://localhost/en/Global_Utilities/Login/?ReturnUrl=/templates/PrimaryLandingPage.aspx?id&epslanguage=EN
Notice there is no id number specified ?!?!?
I thought the 'HandleFormsLogin' would return the correct redirection URL but it doesn't seem to.
How then do I redirect the user after successful login ?
Note that the login page has to be an EPiServer one (not just a normal aspx) since it needs to contain content managed information.
Any ideas are welcome
Thanks
Jim
Hi,
HandleFormsLogin is supposed to return the url you're supposed to go to, if the authentication is successful, and that page is the one you tried to load when you got an access denied response.
If the login page does not get that ReturnUrl querystring parameter, it will default to default.aspx.
I'm not sure why the id is lost in your case, but I bet it has something to do with the new friendly url functionality, and the url rewriter feature.
As a side note, I'd avoid using a template as login page, it might lead you into an access denied loop if the login template is trying to show anything that you're not allowed to see.
/Steve
I can confirm that the problem of the missing value of the ID parameter is caused by the FriendlyUrl HttpModule. I've gotten this confirmed by the support as an EPiServer bug:
0047516: Friendly Urls removes IDs that should be encoded in query strings