4

Is there any way to make some sections of the web.config file only apply to a single file (or directory, or a group of files, etc.)

Basically I would like to apply the following thing only to a single page in the application, the rest should use the default settings: (it limits the upload size to 32M)

<system.web>
  <httpRuntime maxRequestLength="32768" executionTimeout="360"/>
</system.web>

The point is that I only want that particular page to accept large files.

4 Answers 4

14

You can use:

  <location path="UploadPage.aspx">
    <system.web>
      <httpRuntime maxRequestLength="33554432" executionTimeout="360" />
    </system.web>
  </location>

More info here.

Sign up to request clarification or add additional context in comments.

1 Comment

Just what I was looking for +1
2

You can place a web.config file on any directory of your web application, what you define there will only work for that directory and bellow

Comments

0

Yea use the <location path="..."> element to achieve this. The path might point to a directory as well as a file. You will need to set allowDefinition="everywhere".

Comments

0

You can also try it with the <location> tag, however I'm not sure you can use it with <httpRuntime>.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.