简体   繁体   中英

Page transfer in ASP.NET

In Response.redirect ("Page.aspx",bool end response), How do I transfer the page and come back to to the same execution point?

I mean to say how can I use the bool value for my programming purpose.

Please let me know

If i understand " come back to the same execution point " correctly, you might consider using Server.Execute instead.

From MSDN

Executes the handler for a specified resource in the context of the 
current request and returns execution to the page that invoked it.

I think you can create a session variable and stock the "starting point"(url) in the variable. After that you can get the "starting point" from anywhere and go back to this page..

(If it is want you want to do..)

You could to start run all your operation in another thread and then only do response.redirect("someurl"), ie

reponse.redirect("some.aspx");
myoperation();
myoperation1();

replace this code on

ThreadPool.QueueUserWorkItem(delegate 
{
        myoperation();
        myoperation1();        
});
Response.Redirect("some.aspx");

To answer your specific questions:

  • you cannot use the bool parameter for your own purposes - it is there to signal whether to end the response back to the client ( msdn link )
  • when you redirect or transfer to a page you still need to go through the page life cycle, you cannot just start at some arbitrary bit of code on the page. As already mentioned in the answer from InSane, use the Execute method instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM