开发者

How do I (in ASP.NET) determine if the connection is a remote connection?

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜