These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

httpmodules limit the size of upload

In our application inside the web config under httpmodule we need to include one of the ajaxmodule. As well we have included the module for FileVistacontrol inside the httpmodule in order to integrate into our application. When we run our application during the file upload control we are allowed only to upload the file size < 40KB.  When a file of > 50KB is uploaded the advance bar in the upload control box is refreshing but at the end we get the error message "Error Occured".  

As per the solution suggested in this forum we have put the lines related to the File Vista Control first and other lines following. I have copied the below lines from the web config for reference:
<httpModules>
      <add name="GleamTech.Web.FileTransfer.UploadHttpModule" type="GleamTech.Web.FileTransfer.UploadHttpModule, GleamTech.Web.FileTransfer"/>
      <add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax"/>
</httpModules>

In order to check whether the FileVistaControl is running without any issue we run the code by taking out our Ajax control related statement  from the httpmodule, the File Upload control is running without any issues, we can able to attach the files of even 30MB.

But when we include both the lines into the http module then file upload is limited to only 40KB.  Kindly provide a workaround solution for this.

Cheers
Rama
Rama 3/17/2009 2:42 AM
Hi Rama,
Are you running on IIS7 integrated mode? If so, make sure the upload module of the control is also in the list under <modules> of <system.webServer> section.
Cem Alacayir 3/25/2009 8:50 PM
Dear Alacayir
We are running IIS6 and not IIS7.  So what should be done to overcome this issue.
Cheers
Rama
Rama 3/25/2009 8:56 PM
Ok I have just examined MagicAjaxModule and it hooks to an event before the upload module and this causes the problem.

As you already have the source code of the control, open FileVistaControl\Components\GleamTech.File.Transfer\UploadHttpModule.cs and see line 37:

httpApplication.PreRequestHandlerExecute += new EventHandler(this.OnPreRequestHandlerExecute);

Change this line to

httpApplication.AcquireRequestState += new EventHandler(this.OnPreRequestHandlerExecute);

Note that we are hooking to the AcquireRequestState event instead of PreRequestHandlerExecute because MagicAjaxModule also hooks to AcquireRequestState. Rebuild the project (make sure all the DLLs in bin folders updated) and as long as the upload module is first in the list there will be no problems with MagixAjaxModule.


If you did not have the source code of FileVistaControl, instead you would do a similar change in MagicAjaxModule (which is a open source project). You would open MagicAjaxModule .cs and at line 71 see 

application.AcquireRequestState += new EventHandler(Application_AcquireRequestState);

change this line to

application.PreRequestHandlerExecute += new EventHandler(Application_AcquireRequestState);

We are changing the event to match the original event of FileVistaControl. Note that I am not sure if this change would break MagicAjaxModule or not.
Cem Alacayir 3/25/2009 9:46 PM
Thanks for your suggestion. We have changed the code as suggested by you at line 37 and we rebuild the project. When we run the application under the development environment we were able to upload the files of any size. 

Rama 
Rama 4/10/2009 2:35 PM