Reputation:
im trying to find the domain url in my MVC controller
var currentURL = Request.Url.AbsolutePath ;
this is returning /home/index but notthe domain
any help?
Thanks
Upvotes: 2
Views: 2642
Reputation: 1053
This is what I use in my solution
var currentURL = Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host ;
This will return http://www.domain.com
There may be a way to do this better, but this works for me.
Thanks Alan
Upvotes: 1