Problem using Response.Redirect from a User Control

N

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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top