To allow users to upload files larger than 4MB in size I added:
<httpRuntime maxRequestLength="102400" executionTimeout="600" />
..to my web.config file. Fair enough this works fine. However how do
I check the maxRequestLength value through code?
Let me set a bit of background. I don't actually have any ASPX pages I have
a DLL written in VB.NET that has various classes, one implements
IHttpHandlerFactory
and the GetHandler function.
If a file is uploaded that is greater than the max size defined then
immediately after the GetHandler
function ends execution stops and the browser displays a "page unavailable"
message. Therefore
what I was planing to do was loop through the Request.Files collection in
the current httpcontext
and destory any file whose contentlength\1024 was > maxRequestLength.
However System.Web.HttpRuntime does not expose this property so how do I get
the value?
Regards,
Peter
Hmmm... I'd still like to know how you get the maxRequestLength through
code, but a little test shows
that when an uploaded file exceeds the size limit then
httpContext.Request.Files.Count = 0 (in the example
of uploading only 1 file) and as described the GetHandler function finishes
but returns a "page unavailable"
message to the browser, so not sure how I'm suppose to trap this.
Anybody have any ideas.
Regards,
Peter
"Peter Row" <pete...@oxfordcc.co.uk> wrote in message
news:ufrU8$YuDHA...@TK2MSFTNGP12.phx.gbl...