如何获取当前请求的域? [英] How to get the domain of the current request?
本文介绍了如何获取当前请求的域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在asp.net中,我只想获取域信息?
In asp.net, I want to get just the domain information?
即localhost或example.com
i.e localhost or example.com
可能吗?
该值是否可以为null或保证其100%返回值?
can this value ever be null or its 100% gauranteed to return a value?
推荐答案
HttpContext.Current.Request.Url.Authority
.或将 .Authority
替换为更合适的内容.
HttpContext.Current.Request.Url.Authority
. Or replace .Authority
with something more appropriate.
这篇关于如何获取当前请求的域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文