开发者

Increase maxRequestLength for MVC Controller action

开发者 https://www.devze.com 2023-03-08 17:29 出处:网络
Can I increase maxRequestLength 开发者_运维知识库of ASP.NET request for MVC Controller Action?

Can I increase maxRequestLength 开发者_运维知识库of ASP.NET request for MVC Controller Action?

I have an MVC controller that accepts file and it can be very large. I increased maxRequestLength in web.config, but it is security issue and the best solution for me will be have increased request length only for Upload method. Is it possible?

I tried

<location path="UploadFile">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
      <httpRuntime maxRequestLength="2097151"/>
    </system.web>
  </location>

But it didn't helped

Thank you.


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

AFAIK, no. But you could use a generic HTTP handler instead of a controller action and then your <location path="UploadFile"> will work. For example your handler could be placed in ~/UploadFile/upload.ashx.

0

精彩评论

暂无评论...
验证码 换一张
取 消