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)?
The path attribute defines the site or virtual directory that the configuration settings cover. To specify that the settings in the <location> element apply to the default Web site, set the path attribute to Default Web Site .
Answers. later you can access the file path using: string filePath = ConfigurationManager. AppSettings["Path"].
Yes you can have two web. config files in application.
config files. The configuration files for IIS 7 and later are located in your %WinDir%\System32\Inetsrv\Config folder, and the primary configuration files are: ApplicationHost. config - This configuration file stores the settings for all your Web sites and applications.
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.
You must use one location element for each location that you want to control access to. The path can be a directory, which will make the rules apply to everything in that directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With