Redirect to a different domain but the same server

I have two domains, for example www.male.com and www.female.com, which point to the same application for the website. In this application, I have an HTTP module that checks if a user session is active and if it checks whether the user is male or female.

I want to check from which domain the user entered the site. If the user is a man, but entered (came from) www.female.com, the user should be redirected to www.male.com. The opposite should be done in the case of women.

Another scenario:

  • A male user enters www.female.com/articles/test.aspx and should be redirected to www.male.com/articles/test.aspx

  • the male user enters test.female.com/main/default.aspx, it should be redirected to test.male.com/main/default.aspx.

I am using ASP.NET 3.5 in an IIS 7.0 window.

Gr

Martine

+3
source share
3 answers

You can use Request.Url.Host to determine which site they are on (male.com or female.com), then use Response.Redirect to direct them to the correct site. You can use other properties on Request.Url to determine the exact path that the user is viewing.

+2
source

, . male.com iframe, cookie, cookie . , ip, .

0

- , . , female.com , -, male.com , ( ttl ). male.com , , .

0
source

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


All Articles