Reputation: 31
In an ASP.NET MVC 4 application, I would like to get the URL of the site calling the application. That is, I would like to be able to change the web site slightly depending upon which URL it is called from, and as such need to know how to tell what the calling URL is? I would then call a different index.cshtml file depending on which site it is called from.
Any help would be appreciated
Upvotes: 3
Views: 3600
Reputation: 105029
I'm not completely sure what you want to do, but would this do the trick for you:
Request.UrlReferrer
Or
Request.ServerVariables["HTTP_Referer"]
Although I'd prefer the first one.
Upvotes: 5