This is it This is it - 1 year ago 56
ASP.NET (C#) Question

Multiple paths in location element of web.config

How can I specify multiple paths in one

location
element in web.config?

<location path="Images">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>


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: http://msdn.microsoft.com/en-us/library/b6x6shw7(v=vs.71).aspx

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