Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

: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?

Posted

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.

Do not want others to know what you have done? Better not have done it anyways.

Posted
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.

  • Administrators
Posted

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).

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
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)

Posted
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.
Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...