Reputation: 950
How to do this without changing codes? Like using web.config or on IIS? I found but it looks like it is site-wide.
Upvotes: 2
Views: 4402
Reputation: 2213
Why not use roles and give access accordingly for set of pages?
However there is a IP Address and Domain Restrictions modules in IIS that can be used at site/folder/file level.
So say you have a website samplewebsite hosted on IIS which has a folder Content and a file test.aspx.
The rules you add here will go to applicationhost.config (C:\Windows\System32\inetsrv\config\applicationHost.config) and not your web.config. A sample deny rule will look like below -
<location path="samplewebsite/Content">
<system.webServer>
<security>
<ipSecurity>
<add ipAddress="10.0.0.1" allowed="false" />
</ipSecurity>
</security>
</system.webServer>
</location>
If you want to do the same thing for a page
I am not really sure if this is the best approach as IP restrictions are recommended to be at site/server level.
Upvotes: 3