KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an aspx page where I’m allowing a user to upload a file and I want to cap the max file upload size to be 10MB. IIS7, .NET 3.5. I have the following configured in my web.config file: <location path="foo.aspx"> <system.web> <!-- maxRequestLength: kbytes, executionTimeout:seconds --> <httpRuntime maxRequestLength="10240" executionTimeout="120" /> <authorization> <allow roles="customRole"/> <!-- Deny everyone else --> <deny users="*"/> </authorization> </system.web> <system.webServer> <security> <requestFiltering> <!-- maxAllowedContentLength: bytes --> <requestLimits maxAllowedContentLength="10240000"/> </requestFiltering> </security> <handlers accessPolicy="Read, Script"> <add name="foo" path="foo.aspx" verb="POST" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode" /> </handlers> </system.webServer> </location> I have a custom error handling module that implements IHttpModule . I’ve found that when maxRequestLength is exceeded, HttpApplication.Error does indeed get raised. However when I play with maxAllowedContentLength , the HttpApplication.Error event isn’t being raised and the user gets redirected to a 404.13 page. I've attached with Visual Studio with first chance exceptions turned on nothing is being thrown. My first thought is to check the header content length in an earlier event – are there recommendations/best practices of where I do this? PostLogRequest? EndRequest?
Tags (comma-separated)
Save Edits
Cancel