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

  • Thread starter Thread starter gaurav tyagi
  • Start date Start date
G

gaurav tyagi

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 ?????
 
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 said:
i think you chould clear out the 2nd param :)











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
 
NOT WORKING------------------------------


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


}
 
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
 
it is in same application Management.aspx resides.
both pages are in same application
 
in the button click only response.redirect should be there no try catch
and let me know the result


thomson
 

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

Back
Top