Kiwimoisi
Kiwimoisi

Reputation: 4182

Upload a file in asp.net and c#

I would like to know something .

When I upload a file to the server, when the file around 25mb i can upload it .When it's more, it looks like the response is not ending, so it's not uploading...

This is my webconfig , and on the server the time request limit is 9999 seconds ..

<authorization>
  <deny users="?" />
  <allow users="*" />
</authorization>
<sessionState cookieless="false"/>
<httpRuntime maxRequestLength="1048576"/>
 </system.web>
  <appSettings>
    <add key="FolderPath"  value="uploads" />
  </appSettings>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  </system.serviceModel>
 </configuration>

Upvotes: 2

Views: 300

Answers (2)

Pankaj
Pankaj

Reputation: 10095

Did you try with -1 for maxRequestLength. -1 specifies that there is no limit.

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

If you are hosting this in IIS 7.0 you might also need to increase the limit using the <system.webServer> tag in your web.config by setting the maxAllowedContentLength value:

<system.webServer>
    <security>
        <requestFiltering>
            <!-- limit to 100MB -->
            <requestLimits maxAllowedContentLength="104857600" />
        </requestFiltering>
    </security>
</system.webServer>

The default value is 30000000 bytes which is approximately 28.6MB

Upvotes: 2

Related Questions