response.redirect is not working but server.transfer is working

Discussion in 'ASP .Net' started by gaurav tyagi, Jan 18, 2006.

  1. gaurav tyagi

    gaurav tyagi Guest

    in my appplication if i try to go to next page using
    response.redirect, it does not work and control remains on same page
    but if i use server.transfer control goes to nex page??

    can any one explain me why ?????
     
    gaurav tyagi, Jan 18, 2006
    #1
    1. Advertising

  2. Hi,
    Can you post how you are using Response.Redirect ?
    Patrick

    "gaurav tyagi" <> wrote in message
    news:...
    > in my appplication if i try to go to next page using
    > response.redirect, it does not work and control remains on same page
    > but if i use server.transfer control goes to nex page??
    >
    > can any one explain me why ?????
    >
     
    Patrick.O.Ige, Jan 18, 2006
    #2
    1. Advertising

  3. gaurav tyagi

    gaurav tyagi Guest

    old way (Not
    working)------------------------------------------------------------------------------------------------------

    private void btnManagement_Click(object sender, System.EventArgs e)
    {
    try
    {

    Response.Redirect( "ManagementMenu.aspx", false );
    }
    catch( Exception aExc)
    {
    string sErrMsg = "Failed to go to requested web page !\n\n" +
    "Details:\n\n" +
    aExc.Message;
    GuiManipulator.DisplayErrorPage( this.Page, sErrMsg );
    }


    }

    Next
    way(notWorking)----------------------------------------------------------------------------------------------------



    private void btnManagement_Click(object sender, System.EventArgs e)
    {
    Response.Redirect( "ManagementMenu.aspx", false );

    }


    new
    Way(Working)---------------------------------------------------------------------------------------------------

    private void btnManagement_Click(object sender, System.EventArgs e)
    {
    Server.Transfer("ManagementMenu.aspx");

    }
     
    gaurav tyagi, Jan 18, 2006
    #3
  4. i think you chould clear out the 2nd param :)


    "gaurav tyagi" <> schreef in bericht
    news:...
    > old way (Not
    > working)------------------------------------------------------------------------------------------------------
    >
    > private void btnManagement_Click(object sender, System.EventArgs e)
    > {
    > try
    > {
    >
    > Response.Redirect( "ManagementMenu.aspx", false );
    > }
    > catch( Exception aExc)
    > {
    > string sErrMsg = "Failed to go to requested web page !\n\n" +
    > "Details:\n\n" +
    > aExc.Message;
    > GuiManipulator.DisplayErrorPage( this.Page, sErrMsg );
    > }
    >
    >
    > }
    >
    > Next
    > way(notWorking)----------------------------------------------------------------------------------------------------
    >
    >
    >
    > private void btnManagement_Click(object sender, System.EventArgs e)
    > {
    > Response.Redirect( "ManagementMenu.aspx", false );
    >
    > }
    >
    >
    > new
    > Way(Working)---------------------------------------------------------------------------------------------------
    >
    > private void btnManagement_Click(object sender, System.EventArgs e)
    > {
    > Server.Transfer("ManagementMenu.aspx");
    >
    > }
    >
     
    Edwin Knoppert, Jan 18, 2006
    #4
  5. gaurav tyagi

    gaurav tyagi Guest

    Edwin Knoppert wrote:
    > i think you chould clear out the 2nd param :)
    >
    >
    > "gaurav tyagi" <> schreef in bericht
    > news:...
    > > old way (Not
    > > working)------------------------------------------------------------------------------------------------------
    > >
    > > private void btnManagement_Click(object sender, System.EventArgs e)
    > > {
    > > try
    > > {
    > >
    > > Response.Redirect( "ManagementMenu.aspx", false );
    > > }
    > > catch( Exception aExc)
    > > {
    > > string sErrMsg = "Failed to go to requested web page !\n\n" +
    > > "Details:\n\n" +
    > > aExc.Message;
    > > GuiManipulator.DisplayErrorPage( this.Page, sErrMsg );
    > > }
    > >
    > >
    > > }
    > >
    > > Next
    > > way(notWorking)----------------------------------------------------------------------------------------------------
    > >
    > >
    > >
    > > private void btnManagement_Click(object sender, System.EventArgs e)
    > > {
    > > Response.Redirect( "ManagementMenu.aspx", false );
    > >
    > > }
    > >
    > >
    > > new
    > > Way(Working)---------------------------------------------------------------------------------------------------
    > >
    > > private void btnManagement_Click(object sender, System.EventArgs e)
    > > {
    > > Server.Transfer("ManagementMenu.aspx");
    > >
    > > }












    i have checked this one also
    if i remove second argument , by default it takes true this means
    response.redirect will stop the existing thread and go for new thread
    but here it is not enable to open next page so a blank page comes.
    so if i put false , framework do not close current thread and try to
    open next page thread but here also it is not able to open next page
    so current page remains there

    > >
     
    gaurav tyagi, Jan 18, 2006
    #5
  6. gaurav tyagi

    gaurav tyagi Guest

    NOT WORKING------------------------------


    private void btnManagement_Click(object sender,
    System.EventArgs e)
    {
    Response.Redirect( "ManagementMenu.aspx);


    }
     
    gaurav tyagi, Jan 18, 2006
    #6
  7. gaurav tyagi

    Jim Cheshire Guest

    On 18 Jan 2006 04:06:53 -0800, "gaurav tyagi" <>
    wrote:

    >NOT WORKING------------------------------
    >
    >
    > private void btnManagement_Click(object sender,
    >System.EventArgs e)
    > {
    > Response.Redirect( "ManagementMenu.aspx);
    >
    >
    > }


    When you do a response.redirect like this, the server should send a
    302 HTTP response with a location header that tells the browser where
    to go. The browser will then do an HTTP GET for that location. A
    Netmon trace (or a trace using Ethereal) will give you an indication
    as to what is breaking down.

    Jim Cheshire
    --
    Blog:
    http://blogs.msdn.com/jamesche
     
    Jim Cheshire, Jan 18, 2006
    #7
  8. gaurav tyagi

    thomson Guest

    Tell me where is your Management.aspx page reside?
     
    thomson, Jan 18, 2006
    #8
  9. gaurav tyagi

    gaurav tyagi Guest

    it is in same application Management.aspx resides.
    both pages are in same application
     
    gaurav tyagi, Jan 19, 2006
    #9
  10. gaurav tyagi

    thomson Guest

    Tell me the folder structure
     
    thomson, Jan 19, 2006
    #10
  11. gaurav tyagi

    gaurav tyagi Guest

    in same folder both page resides
     
    gaurav tyagi, Jan 19, 2006
    #11
  12. gaurav tyagi

    thomson Guest

    Remove the try catch block and let me know the result


    thomson
     
    thomson, Jan 19, 2006
    #12
  13. gaurav tyagi

    gaurav tyagi Guest

    there is no folder
    this is a simple application which has no module , no folder
     
    gaurav tyagi, Jan 19, 2006
    #13
  14. gaurav tyagi

    thomson Guest

    in the button click only response.redirect should be there no try catch
    and let me know the result


    thomson
     
    thomson, Jan 19, 2006
    #14
  15. gaurav tyagi

    gaurav tyagi Guest

    there is no try catch
     
    gaurav tyagi, Jan 20, 2006
    #15
    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. Justin
    Replies:
    3
    Views:
    559
    Cowboy \(Gregory A. Beamer\)
    Jul 31, 2003
  2. Harsh Thakur

    Response.Redirect vs Server.Transfer

    Harsh Thakur, Aug 18, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    793
    Harsh Thakur
    Aug 18, 2003
  3. archana
    Replies:
    2
    Views:
    514
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Apr 23, 2007
  4. Sal
    Replies:
    1
    Views:
    1,033
  5. David C. Holley

    server.execute/response.redirect/server.transfer

    David C. Holley, Jan 17, 2004, in forum: ASP General
    Replies:
    6
    Views:
    457
    David Holley
    Jan 18, 2004
Loading...

Share This Page