Base solution for your next web application
Open Closed

Return URL Broken #603


User avatar
0
clientfocusdev created

I've been working with the front end disabled.

If the return URL is an application URL i.e. /Application#/tenant/usersin the AccountController<ActionResult>.Login the return url only has "/Application" nothing past the hash.

How can we get the internal application working without the #, or how can we get c# to accept the string past the has in the parameters of that method?

I tested this in a plain demo from the Zero site and recreated this issue. If I copy the users URL, log out, paste, then log in, I am redirected to the dashboard.


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    This is a general problem since browser does not send after # to the server. You can see this topic: <a class="postlink" href="http://stackoverflow.com/questions/5536560/get-full-url-with-hash-to-use-as-returnurl">http://stackoverflow.com/questions/5536 ... -returnurl</a> There are also other topics in stackoverflow. There are some workarounds you can try.

  • User Avatar
    0
    clientfocusdev created

    Our solution inside of ASP.NET Zero

    Login.cshtml:

    <input type="hidden" name="returnHash" id="returnHash" />
    

    Login.js:

    $("#returnHash").val(window.location.hash);
    

    LoginViewModel.cs:

    public string ReturnHash { get; set; }
    

    AccountController.cs:

    //After inital set returnUrl
    if (!string.IsNullOrWhiteSpace(loginModel.ReturnHash))
    {
         returnUrl = returnUrl +'/'+ loginModel.ReturnHash;
    }
    
  • User Avatar
    0
    hikalkan created
    Support Team

    Thanks a lot. I used your solution in AspNet Zero: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/97">https://github.com/aspnetzero/aspnet-zero/issues/97</a>