开发者

newbie .net question - variable that's equivalent of $_SESSION['SERVER_NAME']

开发者 https://www.devze.com 2023-02-27 02:40 出处:网络
I\'m still new to .net....I\'m trying to find the variable that prints the domain name that an aspx.cs file is currently executing from.I come from PHP land, and it has $_SERVER[\'SERVER_NAME\'] or $_

I'm still new to .net....I'm trying to find the variable that prints the domain name that an aspx.cs file is currently executing from. I come from PHP land, and it has $_SERVER['SERVER_NAME'] or $_SERVER['HTTP_HOST']. What's the .net equivalent for those va开发者_如何学Criables?

Thanks


You have all that in:

HttpContext.Current.Request.Url

In that object you have the Domain, AbsoluteUri, AbsolutePath, etc. Please see this question and this link for more references


Request.ServerVariables["SERVER_NAME"] and Request.ServerVariables["HTTP_HOST"]

0

精彩评论

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