Link to home
Start Free TrialLog in
Avatar of mlg74
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"))

Open in new window

For example this works, by redirecting to /admin/ folder
http://mysite.com/login.aspx?ReturnUrl=%2fadmin%2f

Open in new window

This does NOT work, it redirects to home page even after logging in,
http://mysite.com/mobilelogin.aspx?ReturnUrl=%2fadmin%2f

Open in new window

Avatar of guru_sami
guru_sami
Flag of United States of America image

Is your login.aspx and mobilelogine.aspx using same code for authentication and redirect?
Avatar of mlg74
mlg74

ASKER

Yes exactly the same. It was just copy and pasted, then formatted it fr mobile diaplau
Avatar of mlg74

ASKER

Display
Can you share the mobile login aspx and code-behind.
Avatar of mlg74

ASKER

There is no code behind. I just dropped the control it's all built in.
ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mlg74

ASKER

I will try and report back
Avatar of mlg74

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("ReturnUrl"))
End Sub

And on the login control:
asp:Login ID="Login1" CreateUserText="create new account" CreateUserUrl="~/Register.aspx" runat="server" OnLoggedIn="Login1_LoggedIn">