我可以使用其他参数增加MVC Controller Action的ASP.NET请求的ma
发布时间:2020-12-16 03:47:51 所属栏目:asp.Net 来源:网络整理
导读:我可以使用其他参数增加MVC Controller Action的ASP.NET请求的maxRequestLength吗? 我有一个带有ActionResult的UploadController,看起来像这样. [HttpPost] public ActionResult VideoUpload(int memberId) { var status= _docRepo.SaveDocument(DocumentTy
我可以使用其他参数增加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}); } 文件可能非常大,我在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> 有任何想法吗? 解决方法
MVC控制器操作不使用Web.config的location部分.请参见
this answer for more information.您可以通过
the MaxRequestLength property以编程方式增加它.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ASP.NET – 黑客死亡的黄色屏幕
- asp.net-mvc – 如何将复选框绑定到视图模型的List属性?
- ASP.Net会话状态SQL Server用户权限
- asp.net – 在Windows身份验证开启时使用ajax调用Web服务?
- 身份验证 – ASP:使用JMail进行SMTP身份验证失败
- asp.net – 将href绑定到Code Behind属性
- asp.net-mvc-3 – ASP.NET MVC 3:模型级客户端或远程验证
- asp.net – COM异常 – TYPE_E_CANTLOADLIBRARY?
- asp.net-mvc – 每个请求DbContext发生随机错误
- asp.net – 如何阅读maxAllowedContentLength
推荐文章
站长推荐
- asp.net-mvc – MVC简单模型绑定无法正常工作
- asp.net-mvc-3 – ASP.NET MVC3 – EF数据库优先
- asp.net – 的目的
- asp.net-core – openid connect – 在登录期间识
- asp.net-mvc – 如何应用css类到mvccontrib网格
- asp.net-mvc-3 – 如何在MVC3中将附加列添加到We
- ASP.NETCore使用AutoFac依赖注入
- asp.net-mvc-3 – MVC 3 Razor Meta描述/关键字
- Asp.Net Mvc表单提交之List集合
- asp.net-mvc – ASP.NET MVC如何指定View页面驻留
热点阅读