This is it This is it - 2 years ago 106
ASP.NET (C#) Question

Multiple paths in location element of web.config

How can I specify multiple paths in one

element in web.config?

<location path="Images">
<allow users="?" />

We would like to add styles and images to location, e.g.
<location path="images, styles">

Is it possible to put multiple paths in location element (and how would I do that)?

Answer Source

You cannot do this unless they share the same root folder. I've been known to dump images/styles/javascript into a single folder like "_res" or "_system" and authorize that folder

More info on the location element:

On the path attribute:

Specifies the resource that the contained configuration settings apply to. Using location with a missing path attribute applies the configuration settings to the current directory and all child directories. If location is used with no path attribute and allowOverride is False, configuration settings cannot be altered by Web.config files that are in child directories.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download