- Upload Suite Overview
- What's New?
- Choosing Upload Technology
- Evaluating Upload Suite
- Upload Suite Editions
- System Requirements
- Installation and Deployment Notes
- ActiveX/Java Uploader
- HTML5/Flash Uploader
- Before You Started with HTML5/Flash Uploader
- HTML5/Flash Uploader Architecture
- HTML5/Flash Uploader User Interface
- Getting Started
- Using HTML5/Flash Uploader
- Uploading in ASP.NET
- Configuring HTML5/Flash Uploader ASP.NET
- Saving Uploaded Files in HTML5/Flash Uploader ASP.NET
- Uploading Folders in HTML5 Uploader ASP.NET
- Uploading Additional Data in HTML5/Flash Uploader ASP.NET
- Maintaining Sessions and Authentication in HTML5/Flash Uploader ASP.NET
- Debugging ASP.NET HTML5/Flash Upload Scripts
- Uploading in PHP
- Uploading in Other Platforms
- Uploading Images
- Customizing User Interface
- Configuring Common Upload Settings in HTML5/Flash Uploader
- Configuring Files to be Uploaded in HTML5/Flash Uploader
- Sending File at Once or in Several Parts in HTML5/Flash Uploader
- Configuring Fail-safe Upload
- Uploading Large Amount of Images
- Configuring Restriction Rules for Files
- Using HTML5/Flash Uploader at Runtime
- Using Host and Upload Domains that Differ from One Another
- Enabling Cross-Origin Resource Sharing for HTML5 Uploader
- Uploading to Amazon S3 with HTML5 Uploader
- Uploading in ASP.NET
- Troubleshooting
- Reference
- Licensing Information
- Legal Notices
Maintaining Sessions and Authentication in HTML5/Flash Uploader ASP.NET
If you are going to utilize Flash Uploader in non-Internet Explorer browsers (Firefox, Safari, etc.), you should take care about keeping your session and authentication cookies saved if they are used. The fact is that Flash Uploader does not send cookies in output requests in non-Internet Explorer browsers by default and, therefore, session and authentication tickets are lost during the upload. To work around this problem you can employ special facilities provided either by HTML5/Flash Uploader ASP.NET or HTML5/Flash Uploader JavaScript. Let us consider how to use them.
Using HTML5/Flash Uploader ASP.NET
If you use HTML5/Flash Uploader ASP.NET, session and authentication information will be automatically passed to the upload request. If you are unfamiliar with HTML5/Flash Uploader ASP.NET, please, see the Quick Start with HTML5/Flash Uploader ASP.NET topic.
To restore passed cookies server-side you need to add UploaderModule
module to your web.config, like follows:
<configuration>
<!-- other sections -->
<system.web>
<!-- other sections -->
<!-- IIS6 or IIS7 in Classic mode -->
<httpModules>
<!-- other modules -->
<add name="UploaderModule" type="Aurigma.ImageUploaderFlash.UploaderModule"/>
</httpModules>
<!-- other sections -->
</system.web>
<!-- other sections -->
<system.webServer>
<!-- other sections -->
<!-- IIS7 in Integrated mode -->
<!-- Remove <httpModules> and uncomment this section
if you use Integrated mode instead of Classic.
You can check the pipeline mode in the
Application Pool basic settings.
Alternatively, you can add this param (not recommended):
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="UploaderModule" type="Aurigma.ImageUploaderFlash.UploaderModule"/>
</modules>
-->
<!-- other sections -->
</system.webServer>
<!-- other sections -->
</configuration>In order to configure the ASP.NET authentication scheme you should add the authentication section to your web.config,
for example, like it is shown in the following example:
<authentication mode="Forms">
<forms name="AurigmaUser" loginUrl="~/Login.aspx" defaultUrl="~/Default.aspx"
protection="All" path="/" timeout="525600"/>
</authentication>Using HTML5/Flash Uploader JavaScript API
If you prefer not to use HTML5/Flash Uploader ASP.NET, then you should add cookies to the upload request manually via the
HTML5/Flash Uploader JavaScript. To do this, use the metadata.addCustomField(String, String, Boolean)
method which accepts cookie in the following format: "cookieName=cookieValue". The most convenient place to call this method is the
BeforeUpload event handler, because this event fires when the upload is about to be started.
function beforeUploadHandler(){
var fu = $au.imageUploaderFlash('Uploader1');
fu.metadata().addCustomField('ASP.NET_SessionId','<%=Page.Session.SessionID%>',true);
fu.metadata().addCustomField('<%=FormsAuthentication.FormsCookieName%>',
'<%=Request.Cookies[FormsAuthentication.FormsCookieName].Value %>',true);
};
var fu = $au.imageUploaderFlash({
id: 'Uploader1',
events: { beforeUpload: beforeUploadHandler}
});
fu.writeHtml();The previous example uses ASP.NET_SessionId as session cookie name, because it is default name for this cookie in ASP.NET.
However, you may determine the session cookie name programatically, as follows:
((System.Web.Configuration.SessionStateSection)ConfigurationManager.GetSection("system.web/sessionState")).CookieNameTo restore passed cookies server-side you need to add UploaderModule
module to your web.config, like follows:
<configuration>
<!-- other sections -->
<system.web>
<!-- other sections -->
<!-- IIS6 or IIS7 in Classic mode -->
<httpModules>
<!-- other modules -->
<add name="UploaderModule" type="Aurigma.ImageUploaderFlash.UploaderModule"/>
</httpModules>
<!-- other sections -->
</system.web>
<!-- other sections -->
<system.webServer>
<!-- other sections -->
<!-- IIS7 in Integrated mode -->
<!-- Remove <httpModules> and uncomment this section
if you use Integrated mode instead of Classic.
You can check the pipeline mode in the
Application Pool basic settings.
Alternatively, you can add this param (not recommended):
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="UploaderModule" type="Aurigma.ImageUploaderFlash.UploaderModule"/>
</modules>
-->
<!-- other sections -->
</system.webServer>
<!-- other sections -->
</configuration>