Discussion:
C# File Download issue in Internet Explorer 6
(too old to reply)
Shifali
2009-03-12 09:00:01 UTC
Permalink
Hi,

I am using following code to download '.exe' file in c#. This code is
working fine in all other browsers but it gives error in IE6.0 as:

'Internet explorer can not download file from .Internet Explorer was not
able to open the site. The requested site is either unavailable or can not be
found.'

public void DownloadSetup()
{
String filePath =
Server.MapPath("./ABDownload/GulAktivBedrift.exe");
if (System.IO.File.Exists(filePath))
{
Response.ContentType = "application/exe";
Response.AddHeader("Content-Disposition", "attachment;
filename=" + System.IO.Path.GetFileName(filePath));
Response.Clear();
Response.WriteFile(filePath);
HttpContext.Current.ApplicationInstance.CompleteRequest();
//Response.End();
}
}

My c# code is as follows
--
Thanks,
Shifali
PA Bear [MS MVP]
2009-03-13 18:20:10 UTC
Permalink
IE Developer Center
http://msdn.microsoft.com/en-us/ie/default.aspx

Learn IE
http://msdn.microsoft.com/en-us/ie/aa740473.aspx

HTML and DHTML Overviews and Tutorials
http://msdn.microsoft.com/en-us/library/ms537623.aspx and

Cascading Style Sheets (CSS)
http://msdn2.microsoft.com/en-us/ie/aa740476.aspx

Or you could post here instead:

MSDN IE Development Forums
http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=253&SiteID=1
Post by Shifali
Hi,
I am using following code to download '.exe' file in c#. This code is
'Internet explorer can not download file from .Internet Explorer was not
able to open the site. The requested site is either unavailable or can not
be found.'
public void DownloadSetup()
{
String filePath =
Server.MapPath("./ABDownload/GulAktivBedrift.exe");
if (System.IO.File.Exists(filePath))
{
Response.ContentType = "application/exe";
Response.AddHeader("Content-Disposition", "attachment;
filename=" + System.IO.Path.GetFileName(filePath));
Response.Clear();
Response.WriteFile(filePath);
HttpContext.Current.ApplicationInstance.CompleteRequest();
//Response.End();
}
}
My c# code is as follows
Loading...