Include ASP.NET "ReturnURL" in the absolute URL

I have two secure sites:

siteA.example.com siteB.example.com 

A common tag on the page exists at site.example.com. If you access B.example.com without logging in, you are redirected to site.example.com. The URL ends as follows:

http://siteA.example.com/Account/LogOn?ReturnUrl=%2f

This does not work for me because the return URL actually just ends up returning to the Site.example.com homepage, even if the user visited .B.example.com.

Is there a custom way to fix this? Or should I just connect to one of the global life cycle events to change the response?

+4
source share
3 answers
+2
source

I found this little trick:

change the configuration for

  <forms loginUrl="http://google.com/Login?domain=http://google.fr/" /> 

In cases where google.com enters your credentials and google.fr is an application that requires a registered user.

Then you just have to concatenate this with the ReturnUrl parameter before redirecting the user.

+1
source

When setting the value for returnURL, use UrlHelper. Use overloading, which allows you to set the host name and transfer the file sizeA.example.com.

 UrlHelper.GenerateUrl(null, "action", "controller", "http", "siteA.example.com", null, new { id = "Awesome" }, routes); 
0
source

Source: https://habr.com/ru/post/1399275/


All Articles