How can I check that I run the application on my server means localhost:portnumber or hosted them on the internet
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
.
精彩评论