Home All Groups Group Topic Archive Search About

Problem using Response.Redirect from a User Control

Author
25 May 2005 1:26 AM
Nathan Sokalski
I am using the Response.Redirect method in a User Control to allow visitors
to click an ImageButton to take them to another page. However, when I click
the ImageButton I recieve the following error:


Response is not available in this context.


I am assuming this is due to the fact that I am calling the method from the
User Control rather than the Page. If I use context.Response.Redirect I am
given the following error:


Cannot redirect after HTTP headers have been sent.


However, I do not know of any other way to programmatically send the user to
another URL. What can I do to either make the Response.Redirect method work
from a User Control, or what is another simple way to programmatically send
the user to another page? Thanks.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Author
25 May 2005 9:41 AM
Josh
try

server.transfer("fishpage.aspx");
Author
25 May 2005 8:01 PM
Nathan Sokalski
That takes me to the desired page, however, I did not want to use it because
it does not change the displayed URL in the browser's Address Bar. This is a
problem in my application because the buttons that will be calling the
method are the primary navigation buttons. If I used Server.Transfer every
page on my entire site would have exactly the same URL. This would prevent
users from bookmarking and/or adding pages to their favorites.

--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/
Show quoteHide quote
"Josh" <s@a.com> wrote in message
news:%23VD5I4QYFHA.3096@TK2MSFTNGP15.phx.gbl...
> try
>
> server.transfer("fishpage.aspx");
>