我可以使用其他参数增加MVC Controller Action的ASP.NET请求的maxRequestLength吗?
我有一个带有ActionResult的UploadController,看起来像这样.
[HttpPost]
public ActionResult VideoUpload(int memberId)
{
var status= _docRepo.SaveDocument(DocumentType.Video, Request.Files, memberId);
return Json(new { success = true, status = status});
}
Run Code Online (Sandbox Code Playgroud)
文件可能非常大,我在web.config中增加了maxRequestLenght并且可以上传文件,但我担心安全问题.所以我尝试了这个并且它不起作用:
<location path="VideoUpload">
<system.web>
<httpRuntime maxRequestLength="1024000" executionTimeout="600" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1024000"/>
</requestFiltering>
</security>
</system.webServer>
</location>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?(上传方法使用swfupload)
设置授权时出现问题.首先我得到:
<authorization>
<deny users="?" />
</authorization>
Run Code Online (Sandbox Code Playgroud)
所以我拒绝所有未知用户,然后允许他们查看这些页面:
<location path="Default.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Public">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud)
现在问题..他们可以访问公共页面和Default.aspx ..但不能访问www.mydomain.com或www.mydomain.com/ ..所以www.mydmain.com/Default.aspx工作正常.那么如何让这些工作呢?