asp.net mvc - Need c# code to get domain name -
asp.net mvc - Need c# code to get domain name -
this question has reply here:
what's best method in asp.net obtain current domain? 9 answersneed c# code domain name illustration ("url: http://stackoverflow.com/questions/ask"). need output ("http://stackoverflow.com/")
next time please seek google question see if has been asked , answered. try
var domain = httpcontext.current.request.url.host;
per comments...
var domain = httpcontextbase.current.url.host;
this can mocked unit testing - meaning can set test code .
c# asp.net-mvc
Comments
Post a Comment