views:

109

answers:

1

Hi all,

I have a page that has 4 different usercontrols on it. At a certain point I need to make a redirection using javascript location.replace() and it cannot be made through server. It has to be client side.

So, what I need is call the Response.Clear() in parent page from the usercontrol so nothing else will be written in the page. I think that in the current configuration I have its not possible because I have other 3 usercontrols that might be rendered in the page and I cannot control the order of it so it's not possible to guarantee that nothing else will be written after the Response.Clear().

Do u see anyways of do it?

Thanks a lot!

+2  A: 

Have you tried throwing Response.End() into the mix? I'm not sure what will hapeen if you throw it in the middle of the page lifecycle, but it's worth experimenting I suppose, given your somewhat unsuaul requirements.

Matt Hidinger
Response.End() is generally the way to go - however, if the request was an ASP.NET Ajax request (partial postback) this can cause problems. Not the least of which, being that the Redirect() command is ignored within an Ajax request.
LBushkin
Great guys! It worked very well!Thanks a lot!
tucaz