Page Reload / refresh

DumAsp

Newcomer
Joined
Oct 4, 2005
Messages
15
Location
Ontario Canada
:confused: This is so simple, yet I cant figure it out nor can I find any refence to it anywhere (probably because it is so simple).

How do I force a refresh? What is the syntax for reloading the page?
 
Have you tried Response.redirect("YourPage.aspx") ?

You can also set the property of any of your server controls to AutoPostback, it will force the page to refresh when the control is updated...

I hope it will help.
 
scalf said:
Have you tried Response.redirect("YourPage.aspx") ?

You can also set the property of any of your server controls to AutoPostback, it will force the page to refresh when the control is updated...

I hope it will help.


Thanks that did help but it didn't work.

What I am using is the File System Watcher control which triggers the reload on the file change event. If you are not familliar what the control does is whatcha file for changes, when a change is made to a file the event is triggered.

When I ran this I got the error:

Response is not available in this context.

From the response redeirect code within the 'Changed' event of the file system watcher.
 
Web pages aren't designed to work that way, the client is expected to request a page not have a page forced onto it. There is no way to force a refresh from the server in this way.
Your best bet is to have the client periodically refresh it's view of the server (either manually or use a client side mechanism like javascript).
 
PlausiblyDamp said:
Web pages aren't designed to work that way, the client is expected to request a page not have a page forced onto it. There is no way to force a refresh from the server in this way.
Your best bet is to have the client periodically refresh it's view of the server (either manually or use a client side mechanism like javascript).


Too bad. This seemed like it was going to work quite nicely. Every time I made a change to the document (this was a status file) the event would fire as expected (but generate an error). If only there were a way to send a server generated refresh my plan would have worked perfectly (darn meddling kids)
 
Well you could always make an RPC function that 'polls' a method that checks a (static) variable that would be set by your FileSystemWatcher, and if the RPC function returned true, or whatever to notify the client there was a change, you could use javascript to post back and do whatever processing you needed. However I'd be careful with that because multiple clients (remember - it's web - you could have thousands of sessions going on) simultaneously polling a web server (at a fairly constant rate) can be a very, very, bad thing.
 
bri189a said:
Well you could always make an RPC function that 'polls' a method that checks a (static) variable that would be set by your FileSystemWatcher, and if the RPC function returned true, or whatever to notify the client there was a change, you could use javascript to post back and do whatever processing you needed. However I'd be careful with that because multiple clients (remember - it's web - you could have thousands of sessions going on) simultaneously polling a web server (at a fairly constant rate) can be a very, very, bad thing.


Not much point, if I am doing the repeated refreshing of the page anyway, I can just keep sending the current status from the file whether it is changed or not. At some point the status would change and the next refresh would pick that up.
 
Back
Top