Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set MaxAllowedContentLength/maxRequestLength value per action

How do I set maxAllowedContentLength value per action?

I have a few actions that used to upload files, each one needs a different maxAllowedContentLength value.

It make sense that we don't want to use action filters as we want to filter this request at IIS level. On the other hand, action filter is the best solution from coding perspective, as they coming after the routes, so I the routes change, it continue work.

In IIS6 I know we can use <location> tag to specify maxRequestLength to a specific location. I don't know how to use this approach on IIS7, and I don't like this approach, since the url routes are hand coded in the web.config.

What is the best solution to solve this problem?

like image 340
Fitzchak Yitzchaki Avatar asked Feb 15 '10 19:02

Fitzchak Yitzchaki


1 Answers

I didn't find a way to achieve that, and I don't think that there is. Probably the best thing to do is to use a different IIS Website for the file download actions, with custom web.config.

like image 180
Fitzchak Yitzchaki Avatar answered Oct 02 '22 15:10

Fitzchak Yitzchaki