Tuesday, September 2, 2014

string whatever = Request.RawUrl;

...is a pretty good way to get what is at the URL line into a variable in C# in an ASP.NET MVC Controller action! However, if you are running an MVC site within an iFrame and you need to know the url at the browser itself and not at the iframe HTML tag you'd better use this instead:

string whatever = Request.UrlReferrer.OriginalString;

No comments:

Post a Comment