Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Page Load - Force Refresh in classic asp?

Topic says it. Short version: I need a way to force a refresh of the page on First page-load only. Would be easy in asp.net, but I've no idea how to go about this in classic asp.

Longer version: I'm trying to update a rather large application, and one of its problems is that when you log in, it doesn't yet store the necessary information into sessions unless you click a few specific buttons OR refresh the page... which causes problems when the customer tries to navigate the pages.

I COULD track the sessions and set them manually, but I've failed in that for several hours now, so a forced refresh would be a lot easier. If only there's a way to detect the initial page-load so I won't cause a loop. Redirecting is out of the question as well, since the application has way too much code (all of which is practically uncommented and disorganized) for me to see how it actually builds all the verification checksums etc.

Edit: Thanks for replies and sorry for the late answer. Got some good ideas from you guys. :)

like image 978
Zan Avatar asked Dec 09 '22 20:12

Zan


1 Answers

  1. Check for a session cookie saying if it's the first load or not (true = has been loaded before, false = first load).

  2. a. If false, add a js that will reload the page to the response, and set the cookie to true
    b. If true, do nothing more. The page has been reloaded.

As long as the user keeps updating the session, this should make only the first load reload instantly.

EDIT: In response to a comment, the following is an example of a javascript that would cause the client page to reload. As far as I know, this is browser-independent:

<script type="text/javascript">window.reload();</script>

(I do admit that this seems somewhat like a hack, but it'll work. There might be some other way to make the page reload, without sending an extra javascript command, but I don't know of any in Classic ASP.)

like image 198
Tomas Aschan Avatar answered Jan 26 '23 12:01

Tomas Aschan