Snickbrack
Snickbrack

Reputation: 956

How can I check if a URL is inside my ASP.NET App?

I am planning on creating a login form via ASP.NET MVC with which the user should gets redirected to a new site.

The site to which the user should get redirected to is defined by a script based on the current referrer.

But I want to validate this URL before a user logs in and get redirected to a unknown site outside my server.

How can I check if a URL is from my Application?

Upvotes: 0

Views: 252

Answers (1)

evilGenius
evilGenius

Reputation: 1101

I think it is. Enjoy.

  Url.IsLocalUrl(yourReturnUrl)

Upvotes: 1

Related Questions