Search code examples
asp.netuser-controlsresponseparent

How to clear a parent response content from a usercontrol in asp.net?


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!


Solution

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