I'm trying to implement a bit of functionality that will behave much like the CustomError pages: if the connection is re开发者_如何学运维mote function A() will run; else function B() will run.
The only problem I'm having is that I'm not sure the best way to determine a "remote" connection. Does it matter if I'm running my code on a shared web host? Can I rely on just comparing "my" IP to the request's IP?
That's easy in ASP.NET - just check HttpContext.Current.Request.IsLocal
. It will be true when the request was made from the local computer, and false for a remote computer.
精彩评论