开发者

How do i get the full domain name in asp.net?

I need to check my subdomain name (or if theres no subdomain) in asp.net. Right now i tested by adding s.localdev.com to my host files and use it to visit my asp.net page. Request.Url gives me localhost instead 开发者_如何学运维and RawUrl just gives me what is after the /. (Path and query i think its called). How do i get the full domain so i can check my sub domain?


Request.Url.Authority Or Request.Url.GetLeftPart(UriPartial.Authority)

You might need to remove the http(s):// prefix.

Also look at Request.ServerVariables["HTTP_HOST"]


Request.Url.AbsoluteUri

should do the trick

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜