Browser redirect after server calculations

Results 1 to 4 of 4

Thread: Browser redirect after server calculations

  1. #1
    Volker Guest

    Default Browser redirect after server calculations

    Hi,<BR>I&#039m wondering if there is any possibility to redirect the browser when the server is ready with some calculations. It&#039s like:<BR>The user goes to a page and sees some html. In the background you start some calculations on the server (in my case its a watched download using response.binarywrite) and when these calculations are ready, then the user is redirected to another page.<BR>The problem is obviously, that you cannot make a simple redirect,<BR>because you wrote already to the http-header. <BR>But maybe there is a way to do that. Any ideas?<BR>Thanks<BR>Volker

  2. #2
    Margaret Widholm Guest

    Default RE: Browser redirect after server calculations

    Hi! Have you thought about using a meta-refresh tag? It looks like this:<BR>&#060;meta http-equiv="refresh" content="5;url=nextpage.asp"&#062;<BR>5 is the number of seconds before it redirects to the next page. The problem you&#039d run into would be if your process hadn&#039t completed before it redirected, but if you put the<BR>&#060;%response.buffer=true%&#062; at the beginning of your page you should be ok... Not sure if this helps, but it was a thought.<BR>

  3. #3
    volker Guest

    Default RE: Browser redirect after server calculations

    hummm...I dont think that this helps, because like you said, you can&#039t figure out how long will the calculation take, thats why you can&#039t use this meta refresh.<BR>But where do you mean to put the response.buffer=true - on the page where I will redirect to or where I execute the calculations? May be it works, I just cant imagine how...please, if you could explain it.<BR>Thanks!<BR>Volker

  4. #4
    James Van Booven Guest

    Default RE: Browser redirect after server calculations

    Response.Buffer = True is an ASP statement that tells the server not to send ANYTHING back to the client until 1 of two things happens. (1) You explicitly tell it to send something using Response.Flush, which is rarely used, or (2) The entire page that the user requested has been processed.<BR><BR>For example, let&#039s say I put a Response.Buffer = True statement on page5.asp<BR><BR>Now let&#039s say that the user goes to Page5.asp, and I&#039ve got a really intense database query being executed by that page which pulls a list of items that I&#039m going to display on that page. Because of the Response.Buffer statement, the user won&#039t get ANY HTML (no http-header or anything) until the database query is done and all the items that are needed on that page have been pulled from the database.<BR><BR>It sounds like you want to have a page where the user fills out some input, then you execute your calculations on that page based on their input, and then you redirect them. You&#039ll need to change your flow a little bit for this to work. Have the user fill out the request on pageA.asp, and pass their responses to pageB.asp (preferably form input, but you could use a session variable too). On pageB.asp, you&#039ll have Response.Buffer = True at the very top of the page (it has to be before anything is sent to the client), and then below that you can have your calculation code. Until that calculation code is complete, the server will not send anything back to the end-user.<BR><BR>One downfall of this approach is that it does just what it says... The server sends nothing back to the client until all the calculations are done. To the end user, this appears as if they&#039ve requested the page, but they&#039re getting no response from the server. They&#039ll expect the response from the server to take a couple of seconds, so this is no big deal. The only problem is that if the calculations take more than 30 seconds or a minute, their browser will time out and tell them there was no response from the server. Like, when you try to go to a web site and the web server is down... You&#039re browser tries to contact the server for about 30 seconds or a minute before it tells you that the server couldn&#039t be contacted. Just make sure your calculations don&#039t take THAT long.<BR><BR>James Van Booven<BR>Senior Applications Developer / Network Administrator<BR><BR>To e-mail me, remove no_spam_ from the beginning of the following e-mail address.<BR><BR><BR><BR ><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts