DumAsp Posted October 25, 2005 Posted October 25, 2005 :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? Quote
scalf Posted October 26, 2005 Posted October 26, 2005 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. Quote Scalf. Do not want others to know what you have done? Better not have done it anyways.
DumAsp Posted October 26, 2005 Author Posted October 26, 2005 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. Quote
Administrators PlausiblyDamp Posted October 26, 2005 Administrators Posted October 26, 2005 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). Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
DumAsp Posted October 26, 2005 Author Posted October 26, 2005 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) Quote
bri189a Posted October 26, 2005 Posted October 26, 2005 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. Quote
DumAsp Posted October 27, 2005 Author Posted October 27, 2005 Well you could always make an RPC function that 'polls' a method that checks a (static) variable that would be set by your FileSystemWatcher' date=' 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.[/quote'] 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.