In some cases there is a need to check if the url that is used to access a page corresponds to what we expect.
This can be done like this
if ( Request.RawUrl.ToString() == Url.Action("LogOut", "Account") ){ //The url of the action was used to access this page (and no extra GET parameters or anything hinkey) - and any servername/ip we listen to was used } |
This differs from getting the URI in the way that this is the RawUrl is only the part after the server (so for http://example.com/url/to/stuffs RawUrl would contain /url/to/stuffs where the URI would contain details about how the user got there.