Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deny access to .axd in IIS 7.0 based on IP address

I want to be able to deny access to all but a defined set of IP addresses for a particular .axd in IIS.

At the moment, I'm doing this in the code for the axd (it's a managed handler written in C#)

Is there a way I can do this through configuration (ideally changing web.config) ?

Thanks!

like image 466
Kram Avatar asked Dec 14 '25 14:12

Kram


1 Answers

Here is how I did this using IIS6:

  • Create a dummy blank text file for the handler in the proper directory myhandler.axd
  • Navigate to the file in IIS Manager, Right-Click, Properties
  • Set authentication, IP address restrictions in the File Security tab

Caution: the settings seem to persist even if the dummy file is deleted.

like image 195
Hugh Jeffner Avatar answered Dec 16 '25 19:12

Hugh Jeffner