开发者

How to disable ASP.net custom errors only for a specific IP address?

开发者 https://www.devze.com 2023-01-19 10:20 出处:网络
Does anyone have any idea how to disable asp.net custom errors开发者_开发百科 only for a specific ip address? this will ease debugging exceptions on my server from my office..Despite this is a quite o

Does anyone have any idea how to disable asp.net custom errors开发者_开发百科 only for a specific ip address? this will ease debugging exceptions on my server from my office..


Despite this is a quite old question, i've just got this problem on my environment to solve, and searched how.

There's no obvious way, but i've found this alternative:

You must setup App webconfig > system.web > customErrors > mode TO RemoteOnly

Witch means that you'll just see error on localmachine.

There are 3 steps to leverage RemoteOnly from a remote location.

  1. Set RemoteOnly for customErrors
  2. Have server administrator approve server variable REMOTE_ADDR
  3. Create URL Rewrite rule

See the entire post for details.

Finally, you need to create a rule that can tell that it’s you visiting, and changes REMOTE_ADDR to 127.0.0.1 to make you appear local.

There are multiple ways to tell if it’s you. One is by IP address. This is probably the easiest in most cases, but be careful if you have a dynamic IP, that it could change over time and expose your detailed errors to someone else.

All this is a Scott Forsyth post, that i've found, and copied some parts.


Frankly I am not aware of anything inbuilt. But If I were to solve this, I would add a HttpModule and hookup event handler for Application_Error event and in that handler I would try to find who is the client and what to do with it further.


Instead of messing around with IPs you can make the custom errors only be displayed when being debugged locally. Check here, look at the mode attribute.

0

精彩评论

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