mlg74
asked on
ReturnUrl from mobile Login page not working
I have a .net forms authentication with 2 login pages and ReturnUrl is not working on the 2nd on mobileLogin.aspx. Both the Login.aspx and the mobilLogin.aspx use a .net login control that are identical.
<authentication mode="Forms">
<forms name="Login" loginUrl="login.aspx" protection="All" timeout="7200" path="/"/>
</authentication>
login.aspx redirect:
Response.Redirect("mobileLogin.aspx?ReturnUrl=" + Request.QueryString("ReturnUrl"))
For example this works, by redirecting to /admin/ folderhttp://mysite.com/login.aspx?ReturnUrl=%2fadmin%2f
This does NOT work, it redirects to home page even after logging in,http://mysite.com/mobilelogin.aspx?ReturnUrl=%2fadmin%2f
Is your login.aspx and mobilelogine.aspx using same code for authentication and redirect?
ASKER
Yes exactly the same. It was just copy and pasted, then formatted it fr mobile diaplau
ASKER
Display
Can you share the mobile login aspx and code-behind.
ASKER
There is no code behind. I just dropped the control it's all built in.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will try and report back
ASKER
Thank you, this is how I did it:
Protected Sub Login1_LoggedIn(sender As Object, e As EventArgs)
Response.Redirect("mysite. com" + Request.QueryString("Retur nUrl"))
End Sub
And on the login control:
asp:Login ID="Login1" CreateUserText="create new account" CreateUserUrl="~/Register. aspx" runat="server" OnLoggedIn="Login1_LoggedI n">
Protected Sub Login1_LoggedIn(sender As Object, e As EventArgs)
Response.Redirect("mysite.
End Sub
And on the login control:
asp:Login ID="Login1" CreateUserText="create new account" CreateUserUrl="~/Register.