开发者

How can I check that I run the application on my server means localhost:portnumber or hosted them on the internet

开发者 https://www.devze.com 2023-02-17 02:43 出处:网络
I have a MVC application; in deve开发者_运维技巧lopment machine the debug path goes something like localhost:.

I have a MVC application; in deve开发者_运维技巧lopment machine the debug path goes something like localhost:.

I can check that url of the request my server have is localhost or application hosted on server means they are online.

How can I find out that my application is on development machine?


HttpRequest.IsLocal


Check Request.Url.Hostname and Request.Url.Port.
This will tell you the URL that the user requested.

Alternatively, check Environment.MachineName.

0

精彩评论

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