Alex Koustas
Alex Koustas

Reputation: 91

How to identify in a MVC C# Web site where my home page is loaded from ( ie calling URL)

We have a Web site which is develop in MVC C# and we want to know how to identify where our home page is loaded from ( ie calling URL ), when it is loaded from a link which is in another web site. When someone load my home page from a specific web site I want to understand it and give him special treatment like auto login to the site.

Upvotes: 1

Views: 175

Answers (1)

CodeCaster
CodeCaster

Reputation: 151664

When someone load my home page from a specific web site I want to understand it and give him special treatment like auto login to the site.

No. Nonono. No.

Of course the referrer is already being suggested, but since that is a user-provided value you should definitely not rely on that. Anyone can set the referrer header in their browser, so anyone knowing this can log themselves in to your site.

If you control both sites, you could give a logged in user on site B (the referral site) a token that you incorporate in the link to site A. Then in site A you verify the token's validity and act accordingly.

Upvotes: 4

Related Questions