joecool2005 Posted March 5, 2008 Share Posted March 5, 2008 Hi,I set the script time out for 30 seconds like thisServer.ScriptTimeout = 30I want to display a message when the script is time out. How?ThxJoe Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2008 Share Posted March 5, 2008 The server will automatically do that, it will display a server error that the time limit was reached. If you want to do that yourself then set the timeout to something higher and have a function that executes every second or something to check how long the script has been running and stop if it hits a certain amount. You can only do that with Javascript, not VBscript, and you would use the setInterval function to get your function to run periodically. Server.ScriptTimeout = 60;var start_time = new Date();var max_seconds = 30;intId = setInterval("check_time()", 1000);function check_time(){ var current = new Date(); if ((current.valueOf() - start_time.valueOf()) / 1000 > max_seconds) { Response.Write("timeout"); Response.End(); }} setInterval is a method on the window object I believe in the DOM, so I'm not sure whether that will work in ASP. Worth a try though.Edit: no, apparently that doesn't work. I don't think you can have a custom timeout error message. About the only thing you can do is create a custom error page. <%oError = Server.GetLastError();Response.Write("Sorry, there was an error. The error was " + oErr.Description);%> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.