qestion about ReturnUrl=%2f RRS feed

  • Question

  • User-364255011 posted

    Hi, all,

    Recently I migrated a website from one sever to another and merely changed in the web config file from Version= to Version= update on the new server IIS: the application pool to 4.0 from 2.0), but now every time I load the site URL, for example http://mysite.com, it appendsfunny ReturnUrl=%2f to it, like http://mysite.com/Login.aspx?ReturnUrl=%2f

    and after I login, it still stays in the login page as the link is http://mysite.com/Login.aspx

    and after another login, it will redirect me to the main page....

    how can I remove ?ReturnUrl=%2f from the URL in the first place? (note: if I just type http://mysite.com/Login.aspx in URL bar, and hit enter, there is no isse)


    Friday, July 18, 2014 4:16 PM


  • User281315223 posted

    The ReturnUrl typically just exists as a mechanism to point you back to your previous page after you have authenticated.

    For example if you were navigating to a specific area that required authentication like "Restricted.aspx", it might point you back to your Login.aspx page and append "ReturnUrl=Restricted.aspx" to the QueryString so that when you complete the authentication it knows where to send you.

    The characters you are mentioning "%2f" is an encoded form of the forward slash '/'. This leads me to believe that it might be possible that an additional forward slash is either being entered into your URL prior to building your ReturnUrl. It might simply be referring to '/' as the root of your application, which may have authentication wired up so the following is occurring :

    • Your application loads pointing at the default URL '/'
    • When you attempt to navigate to '/', it triggers the fact that it requires authentication and points you to the Login.aspx page (appending ?ReturnUrl=/ and then encoding it)
    • Then after logging in, it will redirect you to your original location '/' after authenticating.

    You might want to try setting the default Start Action for your application to a location other than '/'.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 18, 2014 4:46 PM