I have a web app that creates an excel XLS file dynamically and places the file in a virtual directory called /download/ on a Win2003 Server with IIS.
I then dynamically create a .ASP file with the below script and place it in the /download/ folder. My goal is to have the Save As dialog ask the user where they want to save the Excel file. This works 99% of the time in production and 100% of the time on my development PC.
The problem is there is 1 excel file that is created that is by far the largest file at 4meg. When the routine runs the XLS file is created and the below ASP file is created but the browser returns a "HTTP 500 Internal Server Error".
Why would the error occur for this one XLS file? Is there a size setting in IIS that I can adjust, assuming it's a file size limitation? If I reduce the file size of this XLS file to under 4meg, the below works fine.
Any solutions?
Thanks,
Jerry
Response.ContentType = "application/x-unknown" ' arbitrary
fn = "myexcelfile.xls"
FPath = "C:\mywebsite\download\" & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn
Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing
Response.End