If you are going to utilize File Downloader in non-Internet Explorer browsers (Firefox, Opera, Safari, etc.), you should take care about keeping your session and authentication cookies saved if they are used. The fact is that File Downloader does not send cookies when tries to get files in non-Internet Explorer browsers by default. Thus, session and authentication tickets are lost during the download. To work around this problem you can employ the Cookie property. This property accepts cookie in the following format: "cookieName=cookieValue", use the semicolon to separate several cookies.

The following two samples set session and authentication cookies in ASP.NET and PHP.

Authetication in ASP.NET

JavaScript

var fd = new FileDownloaderWriter('FileDownloader1');
fd.addParam('Cookie','ASP.NET_SessionId=<%=Page.Session.SessionID%>;' +
	'<%=FormsAuthentication.FormsCookieName%>=' +
	'<%=Request.Cookies[FormsAuthentication.FormsCookieName].Value %>');
fd.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:

C#

((System.Web.Configuration.SessionStateSection)ConfigurationManager.GetSection("system.web/sessionState")).CookieName

Authetication in PHP

JavaScript

var fd = new FileDownloaderWriter('FileDownloader1');
fd.addParam('Cookie','PHPSESSID=<?=$_COOKIE["PHPSESSID"]?>');
fd.writeHtml();