Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.ContentType = "application/vnd.ms-excel" Timeout 1

Status
Not open for further replies.

Tinkerers

Technical User
Sep 26, 2002
90
US
Hi All,

I have an asp page with Response.ContentType = "application/vnd.ms-excel" at the top. This makes Excel open INSIDE the browser window. Trouble is, when my db query takes longer than 30 seconds, the error comes up titled Microsoft Excel, that says "Could not open then the path...". If I shorten the query, so it returns data in less than 30 seconds, everything is fine.

The query does NOT have any errors, as it will open fine if I eliminate the Response.ContentType = "application/vnd.ms-excel" command. I've already added Server.ScriptTimeout=240. What I think is necessary is some way to tell Excel to wait longer before timing out. Any ideas would be appreciated.

Thanks,
Paul
 
I do not think you need to tell Excel anything you just need to set a longer timeout for your script to run.
Try adding these at the top of your page.

Server.ScriptTimeout = 120 ' Sets to 120 seconds
Response.Buffer = True

Paranoid? ME?? Who wants to know????
 
Already tried it ! Here's my code:
<%
Response.ContentType = "application/vnd.ms-excel"
Server.ScriptTimeout=240

Response.Clear
Response.Buffer = True
 
You are setting the contenttype then clearing the response.

How about:
Code:
<%
Server.ScriptTimeout=240

Response.Clear
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"

Paranoid? ME?? Who wants to know????
 
This seems to have corrected the timeout. Thannkyou so much theniteowl !!!
 
If my record set returns lots of records it will not export to xls correctly, instead it puts the code into an xls sheet.
Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top