Is there a Page.Refresh type of Command to refresh a page? I don't want to redirect to the page or refresh in javascript. Any help on this is greatly appreciated. Thanks in advance.
+1
A:
I think this should do the trick (untested):
Page.Response.Redirect(Page.Request.Url.ToString(), true);
Fermin
2010-02-10 21:00:07
Watch out that can be used to do XSS exploits. You're blindly trusting the URL from the user. You'd be better off to do Response.Redirect( "~AbsolutePage.aspx" );
Nissan Fan
2010-02-10 21:05:19
wow, never thought of that. Great point.
Jack Marchetti
2010-02-10 21:26:46
A:
You can just do a regular postback to refresh the page if you don't want to redirect. Posting back from any control will run the page lifecycle and refresh the page.
To do it from javascript, you can just call the __doPostBack() function.
womp
2010-02-10 21:02:28
Wow, harsh. Pretty liberal with the downvotes there hey? He also said no redirects, and it was completely an aside to the rest of the answer.
womp
2010-02-10 21:06:08
I didnt find the answer useful, so I clicked the down arrow. That's just what I do. No offense!
Josh Stodola
2010-02-11 00:06:40
A:
Depending on what exactly you require a Server.Transfer
might be a resource-cheaper alternative to Response.Redirect
. More info here.
Thomas Wanner
2010-02-10 21:05:50