Provides an access to configuration setting of EAUpload component.
Namespace:
EasyAlgo.EAUploadAssembly: EasyAlgo.EAUpload (in EasyAlgo.EAUpload.dll)
Version: 1.3.2.0
Syntax
| C# |
|---|
public class UploadEnvironment |
| Visual Basic (Declaration) |
|---|
Public Class UploadEnvironment |
Remarks
The UploadEnvironment class allows you to access EAUpload configuration settings.
You can use the EasyAlgo.UploadEnvironment type to handle configuration settings.
Using this type, you can work directly with configuration settings and you can extend configuration of EAUpload to include custom settings and also you can change its at the runtime stage.
The UploadEnvironment class allows you to perform the following tasks:
The UploadEnvironment class allows you to perform the following tasks:
- Setting up configuration for a specific upload process. This functionality allows you to set specific settings for each upload process at the starting stage and at the processing stage of an upload.
Note:Not all of settings can be changed dinamically (see description of specific setting) - Setting up configuration for the whole of EAUpload configuration and change it at the runtime stage.
- Ignore httpRuntime maxRequestLength and executionTimeout settings of the machine/web.config file by setting UploadEnvironment properties: MaxRequestLength and ExecutionTimeout
Examples
This example demonstrates how to specify values declaratively for attributes of the EasyAlgo.EAUpload section, which can also be accessed as members of the UploadEnvironment class.
CopyXML
The following code example demonstrates how to use the UploadEnvironment class to change upload setting on the initializing stage.
CopyC#
CopyVB.NET
<EasyAlgo.EAUpload> <Environment TemporaryPath="C:\Temp" ChunkSize="65536" ProcessPages="*" IgnorePages="UploadStatus.aspx" UploadID="UploadIdParam" UploadTTL="60" MaxRequestLength="1048576" EnableProgressInfo="true" SerialKey="... valid serial key..." /> <ErrorsProcessing ThrowErrorsImmediately="true" ProcessRequestOnError="true" /> </EasyAlgo.EAUpload>
The following code example demonstrates how to use the UploadEnvironment class to change upload setting on the initializing stage.
// Global.asax.cs using System; using System.Collections; using System.ComponentModel; using System.Web; using System.Web.SessionState; using System.IO; using System.Text; using EasyAlgo.EAUpload; namespace EAUploadExamples { /// / <summary> /// / Summary description for Global. /// / </summary> public class Global : System.Web.HttpApplication { /// / <summary> /// / Required designer variable. /// / </summary> private System.ComponentModel.IContainer components = null; public Global() { InitializeComponent(); } public override void Init() { UploadEnvironment _Environment = EAUploadModule.CommonEnvironment; _Environment.TemporaryPath = "C:\\Temp"; _Environment.ChunkSize = 16384; _Environment.ProcessPages = "UploadFile.aspx"; _Environment.UploadID = "UploadIdParam"; _Environment.MaxRequestLength = 1048576; _Environment.EnableProgressInfo = true; _Environment.ThrowErrorsImmediately = true; _Environment.ProcessRequestOnError = true; _Environment.EAUploadRequestLengthExceededRedirect = "CustomErrorPage.aspx"; base.Init(); } protected void Application_Start(Object sender, EventArgs e) { } protected void Application_Error(Object sender, EventArgs e) { } protected void Application_End(Object sender, EventArgs e) { } #region Web Form Designer generated code /// / <summary> /// / Required method for Designer support - do not modify /// / the contents of this method with the code editor. /// / </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); } #endregion } }
' Global.asax.vb Imports System.Web Imports System.Web.SessionState Imports EasyAlgo.EAUpload; Public Class Global Inherits System.Web.HttpApplication #Region " Component Designer Generated Code " Public Sub New() MyBase.New() 'This call is required by the Component Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Required by the Component Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Component Designer 'It can be modified using the Component Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() components = New System.ComponentModel.Container() End Sub #End Region Public Overrides Sub Init() Dim _Environment As UploadEnvironment = EAUploadModule.CommonEnvironment _Environment.TemporaryPath = "C:\Temp" _Environment.ChunkSize = 16384 _Environment.ProcessPages = "UploadFile.aspx" _Environment.UploadID = "UploadIdParam" _Environment.MaxRequestLength = 1048576 _Environment.EnableProgressInfo = True _Environment.ThrowErrorsImmediately = True _Environment.ProcessRequestOnError = True _Environment.EAUploadRequestLengthExceededRedirect = "CustomErrorPage.aspx" End Sub Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the application is started End Sub Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Fires when an error occurs End Sub Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the application ends End Sub End Class
