---
title: "Maintaining Sessions and Authentication in ActiveX/Java Uploader ASP.NET"
canonical: https://www.aurigma.com/docs/us8/maintaining-sessions-and-authentication-in-aspnet-iu.htm
product: "Upload Suite 8"
---

# Maintaining Sessions and Authentication in ActiveX/Java Uploader ASP.NET
 
If you are going to utilize ActiveX/Java Uploader in non-Internet Explorer browsers (Firefox, Safari, and etc.), you should take care about keeping your session and authentication cookies saved if they are used. The fact is that ActiveX/Java 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 ActiveX/Java Uploader ASP.NET or ActiveX/Java Uploader JavaScript. Let us consider how to use them.

## Using ActiveX/Java Uploader ASP.NET Control
 
If you use ActiveX/Java Uploader ASP.NET, session and authentication information will be automatically passed to the upload request. If you are unfamiliar with ActiveX/Java Uploader ASP.NET, please, see the [Quick Start with ActiveX/Java Uploader ASP.NET](https://www.aurigma.com/docs/us8/quick-start-with-image-uploader-aspnet.htm.md) topic.
 
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:
 ```xml
<authentication mode="Forms">
  <forms name="AurigmaUser" loginUrl="~/Login.aspx" defaultUrl="~/Default.aspx"
         protection="All" path="/" timeout="525600"/>
</authentication>
```

## Using ActiveX/Java Uploader JavaScript API
 
If you prefer not to use ActiveX/Java Uploader ASP.NET, then you should add cookies to the upload request manually via the ActiveX/Java Uploader JavaScript. To do this, use the [metadata.cookie](https://www.aurigma.com/docs/us8/JA_P_J_$au_metadata_cookie.htm.md) property which accepts cookie in the following format: `"cookieName=cookieValue"`.
 ```
var u = $au.uploader({
    id: 'Uploader1',
    metadata: {
        cookie: 'ASP.NET_SessionId=<%=Page.Session.SessionID%>;' +
            '<%=FormsAuthentication.FormsCookieName%>=' + 
            '<%=Request.Cookies[FormsAuthentication.FormsCookieName].Value %>'
    }
}); 

u.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:
 ```csharp
((System.Web.Configuration.SessionStateSection)ConfigurationManager.GetSection("system.web/sessionState")).CookieName
```

## See Also
 
### Reference
 
- [metadata Class](https://www.aurigma.com/docs/us8/JA_T_J_$au_metadata.htm.md)
- [Uploader Class](https://www.aurigma.com/docs/us8/JA_T_Aurigma_ImageUploader_Uploader.htm.md)
- [BeforeUpload Event](https://www.aurigma.com/docs/us8/JA_E_Uploader_BeforeUpload.htm.md)

### Manual
 
- [Quick Start with ActiveX/Java Uploader ASP.NET](https://www.aurigma.com/docs/us8/quick-start-with-image-uploader-aspnet.htm.md)
- [Using JavaScript API](https://www.aurigma.com/docs/us8/using-javascript-api.htm.md)
