If you don’t select the Register in Web.config item from C1Upload’s smart tag then you will need to change the configuration in your web.config file.
In order to make the C1Upload work, some configuration items need to be added to the application web.config file.
Note: The configuration file sections and attributes are case sensitive. Please use the correct case as demonstrated in below samples.
The configuration sections are slight different in the IIS versions prior to version 7 and IIS 7.
1. Add the UploadModule.
ComponentOne UploadModule contains the core processing logic to parse and save the uploaded data
Open the web.config file and add the below sections:
[IIS prior to version 7]
<system.web>
……
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<!-- ******* Register the
UploadModule for IIS prior to v.7 ******
-->
<add
type="C1.Web.UI.Controls.C1Upload.UploadModule,C1.Web.UI.Controls.2"
name="C1UploadModule" />
</httpModules>
</system.web>
[IIS 7]
<system.webServer>
…..
<modules>
<add name="ScriptModule" preCondition="integratedMode"
type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<!-- ******* Register the
UploadModule for IIS 7 ****** -->
<add name="C1UploadModule"
type="C1.Web.UI.Controls.C1Upload.UploadModule,C1.Web.UI.Controls.2"
/>
</modules>
</system.webServer>
2. Add the UploadProgressHandler.
ComponentOne UploadProgressHandler is the HttpHandler that receives progress query request and responses progress data to client.
Open the web.config file and add the below sections:
[IIS prior to version 7]
<system.web>
……
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add
verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add
verb="*" path="*_AppService.axd" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add
verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false"/>
<!-- ******* Register the
UploadProgressHandler for IIS prior to v.7 ******
-->
<add verb="*"
path="C1UploadProgress.axd"
type="C1.Web.UI.Controls.C1Upload.UploadProgressHandler,C1.Web.UI.Controls.2"
/>
</httpHandlers>
</system.web>
[IIS 7]
<system.webServer>
…..
<handlers>
<remove
name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx"
preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add
name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd"
preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add
name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD"
path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add
name="C1UploadProgressHandler" verb="*" path="C1UploadProgress.axd"
type="C1.Web.UI.Controls.C1Upload.UploadProgressHandler,C1.Web.UI.Controls.2"
/>
</handlers>
</system.webServer>
3. Extend the file size limitation.
You can upload files with a combined size of up to 2GB, but it requires some modifications in your application web.config file.
Open the web.config file and add the below sections:
[IIS prior to version 7]
<system.web>
<httpRuntime
maxRequestLength="102400" executionTimeout= "3600"
/>
......
</system.web>
maxRequestLength specifies the limit for the input stream buffering threshold, in KB. This limit can be used to prevent denial of service attacks that are caused, for example, by users posting large files to the server. The default value is 4096 (4 MB).
If someone selects and uploads files with total size larger than maxRequestLength, this will result in a"Page not found" error.
executionTimeout specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET. The value of this setting is ignored in debug mode. The default in .NET Framework 2.0 is 110 seconds. In the .NET Framework 1.0 and 1.1, the default is 90 seconds.
To enable large file uploads, which can take large periods of time, increase the value of this property.
The above example allows uploading files up to 100MB and upload periods up to 1 hour.
[IIS 7]
<system.webServer>
......
<security
>
<requestFiltering>
<requestLimits
maxAllowedContentLength="1024000000"
/>
</requestFiltering>
</security>
</system.webServer>
|