web.config protect directory

  • Thread starter Thread starter Ryan Moore
  • Start date Start date
R

Ryan Moore

is it possible to protect a single directory within a virtual directory
using that directory's web.config file (for example, the "admin" folder
within a web directory)? If so, how is it done?

thnx
 
You can drop in a web.config into a child directory, and simply override the
defaults that you have in the parent for the properties that you want to
override. So, for example, if you want to require all users to be
authenticated, you could put in:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
</configuration>

All other properties will be carried over, and just the authorization
over-ridden. You can customize based on who you want to authorize.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top