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

mlg74Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

guru_samiCommented:
Is your login.aspx and mobilelogine.aspx using same code for authentication and redirect?
0
mlg74Author Commented:
Yes exactly the same. It was just copy and pasted, then formatted it fr mobile diaplau
0
mlg74Author Commented:
Display
0
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

guru_samiCommented:
Can you share the mobile login aspx and code-behind.
0
mlg74Author Commented:
There is no code behind. I just dropped the control it's all built in.
0
guru_samiCommented:
For your mobilelogin.aspx, can you try a manual redirect to your admin page in the OnLoggedIn Event of the login control.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mlg74Author Commented:
I will try and report back
0
mlg74Author Commented:
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">
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.