views:

777

answers:

6

I have a demo scheduled with a client and i need a quick and dirty fix for now. I will find a more appropriate work around tomorrow but for the time being i need a way to force a post back, or refresh the page.

i tried: Response.Redirect("");

but it brings me to a page that says "Object moved to here". 'here' is a hyperlink that brings me to the page with desired results but i wish to bypass this message.

Any ideas. This is very urgent. Any help would be much appeciated

Thanks, shawn

A: 

Couldn't you just add a javascript block with window.reload() in it?

Here is some useful info on how to do this correctly in Web Forms.

Tomas Lycken
A: 

The server can not tell the client to reload.

You can use the html meta refresh:

 <meta http-equiv="refresh" content="2;url=http://the.new.url"&gt;

but that will not do a proper post back i think.

Content is how many seconds the client waits to do the refresh.

idstam
A: 

Take a look at ASP.NET AJAX Timer Control! http://www.asp.net/ajax/documentation/live/tutorials/IntroToTimerControl.aspx

Khurram Aziz
+1  A: 

Response.Redirect("default.aspx");

(or whatever the name of the current page is)

Travis Collins
Many thank yous Travis.I'm still unsure why Response.Redirect("") didn't work.
ErnieStings
you didn't redirect to anything. If you want to redirect put in path information. If you want to redirect to the configured default page you could put Response.Redirect(".") and Response.Redirect("/") would put you at the configured root default page.
Makach
A: 

Do you need a post back to populate a list? Did you look into if solving it with Ajax could help??

Or if you just need a quick and dirty thing, just fake it and fix it later.

Makach
A: 

Hi Ernie, how did you fix this error?

I'm getting the same error in our Production server but I can't replicate the error in our local and staging servers.

Is the Response.Redirect inside a Try block? I read that it should be passed with a second parameter (set to false) if it's used inside a Try block.

Response.Redirect("Default.aspx",false);
witwiw