Wednesday, February 29, 2012
ASP.NET Location Node in web.config
Just a quick one today! This has probably been around for a while now but yesterday I had good cause to use this handy piece of functionality!The location tag within the web config file of your asp.net 4 website allows you to specify a location tag with a path attribute and set "web.config" style setting for just that single location! This is particularly handy if you need to set request upload limits or request validation settings for a particular page that handles file uploads or downloads.
Here is an example which allows for the upload of very large files and allows a URL Encoded filename (with some very odd characters) to be downloaded
<location path="somefolder/download-resource-page.aspx" allowOverride="false">
<system.web>
<httpRuntime requestValidationMode="2.0" executionTimeout="3600" maxRequestLength="1048576" requestPathInvalidCharacters="" />
<pages validateRequest="false" />
</system.web>
</location>
This location section should be placed within the <configuration>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment