Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I increase maxRequestLength of ASP.NET request for MVC Controller Action with additional parameters?

Can I increase maxRequestLength of ASP.NET request for MVC Controller Action with additional parameters?

I have a UploadController with a ActionResult looking somthing like this.

  [HttpPost]
  public ActionResult VideoUpload(int memberId)
  {
    var status= _docRepo.SaveDocument(DocumentType.Video, Request.Files, memberId);
        return Json(new { success = true, status = status});
  }

The files can be very large, i have increaset maxRequestLenght in web.config and can upload the files, but im worried about the security issue. So i tried this and its not working:

 <location path="VideoUpload">
        <system.web>
            <httpRuntime maxRequestLength="1024000" executionTimeout="600" />
        </system.web>
        <system.webServer>
            <security>
                <requestFiltering>
                    <requestLimits maxAllowedContentLength="1024000"/>
                </requestFiltering>
            </security>
        </system.webServer>
    </location>

Any ideas? (the upload method is using swfupload)

like image 675
loddn Avatar asked Nov 08 '11 10:11

loddn


1 Answers

MVC Controller Actions do not use the location section of the Web.config. See this answer for more information. You can increase it programmatically via the MaxRequestLength property.

like image 52
Heretic Monkey Avatar answered Nov 15 '22 05:11

Heretic Monkey