Increase file upload limit by C # App.Config?

0

I have a problem, we use a file upload system that was done in WebApplication and we will implement it in a dll as well. In WebApplication, you can configure the Web.config maximum size of the file to be sent using the maxRequestLength (IIS

asked by anonymous 26.12.2017 / 15:09

2 answers

0

Can be configured in web.config of the application that will use this DLL.

I believe you will not be able to configure the maxRequestLength, maxAllowedContentLength application parameters through the DLL as these parameters are global.

    
26.12.2017 / 15:13
0

Good morning, try to configure the two variables in the same file:

Adding the variable "maxRequestLength":

<system.web>
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime maxRequestLength="2000000" targetFramework="4.5.2" />
 </system.web>

Adding the variable "maxAllowedContentLength":

<security>
        <requestFiltering>
          <requestLimits maxAllowedContentLength="2000000" />
        </requestFiltering> 
 </security> 

Make sure you are authorizing access to the method you are accessing:

<httpProtocol>
 <customHeaders>
<add name="Access-Control-Allow-Headers" value="Content-Type" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
 </customHeaders>
</httpProtocol>
    
27.12.2017 / 11:21