Problem using Response.Redirect from a User Control

Discussion in 'ASP .Net Web Controls' started by Nathan Sokalski, May 25, 2005.

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

    http://www.nathansokalski.com/
     
    Nathan Sokalski, May 25, 2005
    #1
    1. Advertisements

  2. Nathan Sokalski

    Josh Guest

    try

    server.transfer("fishpage.aspx");
     
    Josh, May 25, 2005
    #2
    1. Advertisements

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

    http://www.nathansokalski.com/
    "Josh" <> wrote in message
    news:%...
    > try
    >
    > server.transfer("fishpage.aspx");
    >
     
    Nathan Sokalski, May 25, 2005
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S.Kartikeyan
    Replies:
    0
    Views:
    3,064
    S.Kartikeyan
    Mar 1, 2004
  2. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    6,128
    Srowe1975
    Oct 15, 2008
  3. =?Utf-8?B?TWFydHkgVS4=?=

    Response.Redirect from User Control Page_Load

    =?Utf-8?B?TWFydHkgVS4=?=, Dec 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    5,544
    =?Utf-8?B?TWFydHkgVS4=?=
    Dec 10, 2004
  4. =?Utf-8?B?QW5kcmUgUmFuaWVyaQ==?=

    Response.Redirect() and absolute URL links and User Control questi

    =?Utf-8?B?QW5kcmUgUmFuaWVyaQ==?=, Feb 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,079
    Steve C. Orr [MVP, MCSD]
    Feb 4, 2005
  5. Nathan Sokalski
    Replies:
    2
    Views:
    2,957
    Nathan Sokalski
    May 25, 2005
  6. André
    Replies:
    3
    Views:
    2,113
    André
    Dec 1, 2006
  7. DCarroll
    Replies:
    4
    Views:
    230
    Steven Cheng[MSFT]
    Sep 27, 2005
  8. Sal
    Replies:
    1
    Views:
    1,644
Loading...