RedirectFromLoginPage not working...
Posted on 2009-02-13
I seem to have hit a wall with this one and id be grateful for any help.
I have the following code AFTER a user is authenticated:
If Request.QueryString("ReturnURL") = Nothing Then
Without touching the <authorization> section of the web.config I understand that by default you get:
<allow users="*" />
However, if an unauthenticated user attempts to view a page they are NOT redirected to the login page.
Adding the following has a different affect:
<deny users="?" />
The above example has a strange behaviour - it redirects an unauthenticated user to the login page WITH a ReturnURL BUT..........when a user is authenticated (correctly) on the login page they are redirected back to .... the login page! (with a ReturnURL).
Logging in the 2nd time redirects you to the desired home page.
Not really sure what I have done :P but I am confused now.
The other part of my web.config is as follows:
<forms name=".iMedia" loginUrl="index.aspx" defaultUrl="index.aspx" timeout="999" protection="All" path="/" slidingExpiration="True"/>
I would like for unauthenticated users who access a secure page to be redirected to the login page with a ReturnURL.
And to be able to login successfully first time!
Please note that I am not using ASP.NET Membership, but my own database authentication method.