Setting maxrequestlength in the page

G

Guest

I'm running into the notorious 4MB upload limit. I see where one answer is
to set a higher limit to the httpRunTime MaxRequestLength setting in
web.config. However this affects the whole application, and if I'm going to
increase this limit, I'd rather only increase it for the one page that needs
it, the one with the FileUpload controls.

So it was great to see the .NET Framework 2.0 now allegedly supports this in
the page. So I tried it (the application is set to the 2.0 Framework,, and
I'm using VS2005). I removed the setting in web.config so that all pages
would default to the 4MB limit. Then, on my page with the FileUpload
controls, I added the following code:

<%@ import Namespace="System.Web.Configuration" %>

Dim httpConfig As HttpRuntimeSection = New HttpRuntimeSection

Sub Page_Load()
httpConfig.MaxRequestLength = 8192
... other code to handle the uploading ...
End Sub

However, it doesn't seem to work. I still get the "Maximum request length
exceeded" errors when I upload a file larger than 4MB.

Am I implementing this properly, or am I missing something?

-Robert-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top