Installing the HttpModule


FileUpEE's HttpModule is an interceptor that is used under ASP.NET to overcome inefficient memory utilization and disk caching performance in ASP.NET uploads. Additionally, it enables accurate server-side progress indication. The HttpModule intercepts an upload request, reads all the data, and writes it to a temp file chunk by chunk before sending it to ASP.NET. With the HttpModule and chunked transfer encoding, upload size in ASP.NET is unlimited.

It should be noted, however, that all major internet browsers have upload limits of 2 GB. Larger uploads must be generated by a client-side control that can handle very large transfers. FileUpEE includes SoftArtisans XFileEE, a client-side file transfer control that can submit uploads of any size.

For performance reasons, the HttpModule can be configured not to intercept all ASP.NET requests. SoftArtisans suggests that only requests for files with the extension .uplx be handled by the HttpModule, allowing requests with the extension .aspx to be sent directly to ASP.NET. This prevents burdening the server with unnecessary use of the HttpModule.

Note: You can use any file extension as the FileUpEE Module file extension, provided that it is 7 or fewer characters in length and is not already in use. In order to use a file extension other than .uplx, replace .uplx with your own custom extension in the instructions listed below.

  1. Install the HttpModule
    The HttpModule can be installed in the Global Assembly Cache (GAC) or on the application level. SoftArtisans recommends installing on the application level.

    To install HttpModule on the application level (recommended):

    Under <system.web>, add the following node, which adds the FileUpEE HttpModule to the project:

    <httpModules> 
        <add name="FileUpEeModule" type="SoftArtisans.Net.FileUpEeFilter.Module.FileUpEeModule,
            FileUpEeModule, version=x.x.x.x, Culture=neutral, PublicKeyToken=f593502af6ee46ae"/>
    </httpModule>

    Directly under the previous node, add the following node, which allows the .uplx extension to be processed by .NET:

    <httpHandlers> 
        <add verb="*" path="*.uplx" type="System.Web.UI.PageHandlerFactory"/>
    </httpHandlers>


    If you are running FileUpEE on version 2.x of the .NET framework, add the following under the <compiliation> node:

    <compilation> 
        <buildProviders> 
            <add extension=".uplx" type="System.Web.Compilation.PageBuildProvider"/>
        </buildProviders> 
    </compilation>
                                
  2. Add a reference to the HttpModule assembly in Visual Studio.
    1. Open your project in Visual Studio

    2. Right click on your solution and select "Add Reference"

    3. Select the "Browse" tab and navigate to SoftArtisans\FileUpEE\dotnet

    4. Select FileUpEEModule.dll

  3. Add the configuration settings to the web.config file
    Past versions of the FileUpEE HttpModule have used the registry key to store important configuration information. The current version of the HttpModule stores these values on the application level in the <appSettings> node of the web.config file. A table detailing the use of these settings can be found on the HttpModule Application Keys page.

    The following is a list of settings to be added to the <appSettings> node in your application's web.config file. These are sample values and should be changed to suit the needs of your application.
    <appSettings> 
        <add key="Resumable" value="true" /> 
        <add key="AllowClientOverride" value="true"/> 
        <add key="FileUpEeTempDir" value="C:\Temp\FileUpEe\Cache" /> 
        <add key="TransferStage" value="1" /> 
        <add key="UseHttpModuleWithAspDotNet" value="true"/>
        <add key="FilterAspDotNetFlagExtension" value=".uplx" /> 
        <add key="FilterAspDotNetAtNKiloBytes"value="0"/> 
        <add key="MaxKBytes" value="0" /> 
        <add key="MaxKBytesToCancel" value="0"/> 
        <add key="ProgressIndicator" value="true" /> 
        <add key="ProgressIndicatorParam" value="progressid" /> 
        <add key="DynamicAdjustScriptTimeout" value="true" />
        <add key="ErrorLogDestination" value="0" /> 
        <add key="ErrorLogFile" value="C:\Temp\logs\FileUpEeModuleError.log"/> 
        <add key="TraceLogFile" value="C:\Temp\logs\FileUpEeModuleTrace.log" />
        <add key="FilterReadBufferNKiloBytes" value="32" /> 
        <add key="MaxReadMemoryKiloBytes" value="16000" />
        <add key="FileWriteBufferNKiloBytes" value="32" /> 
    </appSettings>
                    
    A sample web.config file for the HttpModule installed on the application level can be found on our Sample web.config page, complete with explanations of each value.

  4. Allow ASP.NET to Process Files with the .uplx Extension
    Though the FilterAspDotNetFlagExtension application setting key can be used to intercept files with any file extension, including .aspx, using FileUpEE's HttpModule, SoftArtisans recommends using extension .uplx to keep from filtering .aspx files that do not use FileUpEE. After a request is handled by the HttpModule, the request is forwarded to ASP.NET. To allow ASP.NET to process files with the extension .uplx, you must add a script map to IIS (for security reasons, FileUpEE's automatic installation does not add the script map automatically).

    In the Windows XP IIS console, the Web Sites and Default web Site nodes have identical properties dialogs. The script maps can be installed in the web Sites properties, but they will be ignored by IIS. The script maps must be installed from the node containing your FileUpEE application.


    • Add .uplx to the Default web Site's App Mappings
      1. Open IIS, right-click the Default web Site, and select Properties.
      2. Select the Home Directory tab.
      3. Click Configuration.
      4. Select the App Mappings tab.
      5. Click Add.
      6. Browse to aspnet_isapi.dll (typically in [Windows directory]\Microsoft.NET\Framework\[.NET version directory]\).
      7. In the Extension field, enter uplx.
      8. Select All Verbs.
      9. Check Script Engine, and click Ok.

      OR

    • Add .uplx to the Application's App Mappings
      1. Open IIS, right-click your application's virtual directory, and select Properties.
      2. Select the Virtual Directory tab.
      3. Click Configuration.
      4. Select the App Mappings tab.
      5. Click Add.
      6. Browse to aspnet_isapi.dll (typically in [Windows directory]\Microsoft.NET\Framework\[.NET version directory]\).
      7. In the Extension field, enter uplx.
      8. Select All Verbs.
      9. Check Script Engine, and click Ok.


    Under ASP.NET, FileUpEE's progress indicator is handled by the HttpModule. So, to display accurate progress indication, upload to a page with the .uplx extension.



Installing the FileUpEE HttpModule in the GAC

To install HttpModule in the GAC:

  1. Open a command prompt window and move to the directory FileUpEE\DotNet.

  2. Enter gacutil /i FileUpEeModule.dll.

  3. Open the file machine.config (in [Windows directory]\Microsoft.NET\Framework\[.NET version directory]\CONFIG).

  4. Add the following to the <httpHandlers> node of machine.config:
    <add verb="GET,HEAD,POST" path="*.uplx" type="System.Web.UI.PageHandlerFactory" />
    Add the line above to machine.config before these entries:
    <add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler" />
    <add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler" />


    Add the following to the httpModules node of machine.config:
    <add name="FileUpEeModule" type="SoftArtisans.Net.FileUpEeModule, FileUpEeModule,
        Version=x.x.x.x, Culture=neutral, PublicKeyToken=f593502af6ee46ae"/>


    Add the following to the assembly node of machine.config:
    <add assembly="FileUpEEModule, Version=x.x.x.x, Culture=neutral, 
        PublicKeyToken=f593502af6ee46ae"/>


    If you are running FileUpEE on version 2.x of the .NET framework, add the following under the <compiliation> node:

    <compilation> 
        <buildProviders> 
            <add extension=".uplx" type="System.Web.Compilation.PageBuildProvider"/>
        </buildProviders> 
    </compilation>
                                


To add the FileUpEE assemblies to your application after having installed it in the GAC, follow the same instructions as you would for adding the assembly on the application level, making sure that the FileUpEE dlls that you add to your application are the ones that have been registered in the GAC.



The version attribute must correspond exactly to the version of FileUpEeModule.dll that you added to the GAC. If you add a new version of FileUpEeModule.dll to the GAC, update the version attribute in machine.config. To get the exact version of FileUpEeModule.dll, right-click the file and select the Properties tab.

Top


Copyright © 2010 SoftArtisans, Inc. All rights reserved.