How to increase the max upload file size in ASP.NET?

后端 未结 15 2929
青春惊慌失措
青春惊慌失措 2020-11-22 06:09

I have a form that excepts a file upload in ASP.NET. I need to increase the max upload size to above the 4 MB default.

I have found in certain places referencing the

相关标签:
15条回答
  • 2020-11-22 06:28

    If you use ssl cert your ssl pipeline F5 settings configure.Important.

    0 讨论(0)
  • 2020-11-22 06:34

    Max file size can be restricted to a single MVC Controller or even to an Action.
    web.config <location> tag can be used for this:

    <location path="YourAreaName/YourControllerName>/YourActionName>">
      <system.web>
        <!-- 15MB maxRequestLength for asp.net, in KB 15360 -->
        <httpRuntime maxRequestLength="15360" />
      </system.web>
      <system.webServer>
        <security>
          <requestFiltering>
            <!-- 15MB maxAllowedContentLength, for IIS, in bytes 15728640 -->
            <requestLimits maxAllowedContentLength="15728640" />
          </requestFiltering>
        </security>
      </system.webServer>
    </location>
    

    Or you can add these entries in area's own web.config.

    0 讨论(0)
  • 2020-11-22 06:37

    You can write that block of code in your application web.config file.

    <httpRuntime maxRequestLength="2048576000" />
    <sessionState timeout="3600"  />
    

    By writing that code you can upload a larger file than now

    0 讨论(0)
提交回复
热议问题