Problem using Response.Redirect from a User Control

Discussion in 'ASP .Net' 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. Advertising

  2. Nathan Sokalski

    Josh Guest

    try

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

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

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:
    2,798
    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:
    5,262
    Srowe1975
    Oct 15, 2008
  3. André
    Replies:
    3
    Views:
    1,907
    André
    Dec 1, 2006
  4. Sal
    Replies:
    1
    Views:
    582
  5. Nathan Sokalski

    Problem using Response.Redirect from a User Control

    Nathan Sokalski, May 25, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    454
    Nathan Sokalski
    May 25, 2005
Loading...

Share This Page