If you want to do this for a "web page", then I would use IsLocal, but if you want to use a subdirectory, I would use Url Rewrite 2. http://www.microsoft.com/web/gallery/install.aspx? appid = urlrewrite2 . If you donβt have it yet, go and get it as very useful. I believe that it will be standard for IIS8.
Then add this to your web.config under <system.webServer/>
<rewrite> <rules> <rule name="Block Remote Access to Admin" stopProcessing="true" patternSyntax="ECMAScript" enabled="true"> <match url="projects(/|$)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{REMOTE_ADDR}" pattern="localhost" ignoreCase="true" negate="true" /> <add input="{REMOTE_ADDR}" pattern="127.0.0.1" negate="true" /> <add input="{REMOTE_ADDR}" pattern="::1" negate="true" /> </conditions> <action type="CustomResponse" statusCode="403" statusDescription="Forbidden" statusReason="Access to this URL is restricted"/> </rule> <rules> </rewrite>
cirrus
source share