在web.config中指定多个system.web

时间:2012-12-11 03:19:29

标签: web-config httpruntime executiontimeout

我需要更改特定于我的网页的web.config中的executiontimeout设置。

我正在努力下载大文件。为此,我需要单独更改executiontimeout下载页面。但是,如果我将executiontimeout指定为某个值,它将适用于所有页面而不仅仅是下载。但它不应该。

我需要仅针对我的下载的executiontimeout设置。是否可以提出任何建议?

我找到了一个解决方案

它是这样的:

<configuration>                
 <location path="Download.aspx">
    <system.web>
      <httpRuntime requestValidationMode="2.0" maxRequestLength="2048000" executionTimeout="10240" />
      <compilation debug="false" targetFramework="4.0"/>
      <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
    </system.web>
  </location>
  <system.web>
    <!--httpRuntime maxRequestLength="512" useFullyQualifiedRedirectUrl="true" executionTimeout="45"/-->
    <httpRuntime requestValidationMode="2.0" maxRequestLength="2048000"/>
    <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
    <compilation debug="true" targetFramework="4.0"/>
    <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
    <authentication mode="Windows"/>
    <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>

        -->
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
</configuration>

0 个答案:

没有答案