Reputation: 196439
if my current controller, my URL is:
http://test.mysite.com/Person/Detail/1
how can i extract into a variable:
i am sending links inside of emails so i can't just use relative URLs (that why i need something that will get me these URLs
Upvotes: 0
Views: 134
Reputation: 1038710
var fullUrl = Request.RawUrl;
.var rootUrl = Request.Url.GetLeftPart(UriPartial.Authority);
Upvotes: 3
Reputation: 10033
Have a look at this answer it may be of use:
How can I return the current action in an ASP.NET MVC view?
The Uri object is useful when working with URLs also
Upvotes: 0