473,396 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Redirect instantaneously & continue processing page

CK
I have a web page called PageOne.aspx which is supposed to do a long
process but I don't need to show any results to the client, so I want
to redirect the client to PageTwo.aspx right in the beginning of the
Page_Load and then continue with the long process.

So I've tried using Response.Redirect("http://mysite.com/PageTwo.aspx",
false) but the customer is not getting the response only until I finish
processing the whole page.

So I've tried adding Response.Flush();Response.Close(); but it does not
work properly. The first time I go to PageOne I get redirected right a
way but it will cause IE to display "page can not be displayed" instead
of redirecting to PageTwo.aspx, and then if I try again to go to
PageOne in that same browser it will take a long time until it gets to
the "page not found". [caching?]

But if try testing that same page with Wget, perl get they seem to
follow to PageTwo.aspx without incidence.

In short how do you redirect a customer instantaneously to another page
while the first page can still continue doing stuff after the customer
gets the redirect message?

Nov 19 '05 #1
6 2615
Try using Threading.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"CK" <c_****@c-cs.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a web page called PageOne.aspx which is supposed to do a long
process but I don't need to show any results to the client, so I want
to redirect the client to PageTwo.aspx right in the beginning of the
Page_Load and then continue with the long process.

So I've tried using Response.Redirect("http://mysite.com/PageTwo.aspx",
false) but the customer is not getting the response only until I finish
processing the whole page.

So I've tried adding Response.Flush();Response.Close(); but it does not
work properly. The first time I go to PageOne I get redirected right a
way but it will cause IE to display "page can not be displayed" instead
of redirecting to PageTwo.aspx, and then if I try again to go to
PageOne in that same browser it will take a long time until it gets to
the "page not found". [caching?]

But if try testing that same page with Wget, perl get they seem to
follow to PageTwo.aspx without incidence.

In short how do you redirect a customer instantaneously to another page
while the first page can still continue doing stuff after the customer
gets the redirect message?

Nov 19 '05 #2
CK
Thanks,
1) I knew that threading is an option but will I still be able to use
the Session to set values so other pages can read the result?

2) what is the official way to redirect and continue processing the
page?

Nov 19 '05 #3
If your needs are very simple you could probably get away with using
threading as Kevin described.
If you're going to be doing this kind of thing a lot, though, you might
consider triggering a Windows Service to do the work. They are much more
robust for handling background tasks.

Here's more information on Windows Services:
http://msdn.microsoft.com/library/de...owsService.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"CK" <c_****@c-cs.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a web page called PageOne.aspx which is supposed to do a long
process but I don't need to show any results to the client, so I want
to redirect the client to PageTwo.aspx right in the beginning of the
Page_Load and then continue with the long process.

So I've tried using Response.Redirect("http://mysite.com/PageTwo.aspx",
false) but the customer is not getting the response only until I finish
processing the whole page.

So I've tried adding Response.Flush();Response.Close(); but it does not
work properly. The first time I go to PageOne I get redirected right a
way but it will cause IE to display "page can not be displayed" instead
of redirecting to PageTwo.aspx, and then if I try again to go to
PageOne in that same browser it will take a long time until it gets to
the "page not found". [caching?]

But if try testing that same page with Wget, perl get they seem to
follow to PageTwo.aspx without incidence.

In short how do you redirect a customer instantaneously to another page
while the first page can still continue doing stuff after the customer
gets the redirect message?

Nov 19 '05 #4
Hi CK,
1) I knew that threading is an option but will I still be able to use
the Session to set values so other pages can read the result?
Yes. However, that isn't going to be your greatest issue. Be sure to read up
on Threading before you try to use it, and remember that a Page class's
lifetime is very brief.
2) what is the official way to redirect and continue processing the
page?
There is none. A redirect is a header that is added to the Response. It
tells the browser to retrieve the URL it indicates. It can't be sent until
the Response is sent.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"CK" <c_****@c-cs.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com... Thanks,
1) I knew that threading is an option but will I still be able to use
the Session to set values so other pages can read the result?

2) what is the official way to redirect and continue processing the
page?

Nov 19 '05 #5
CK
Thanks,

1. The link to windows service you posted is not found can you tell if
you meant this page?
http://msdn.microsoft.com/library/de...pplication.asp

2. can you please describe what you mean by saying "triggering a
Windows Service"? is it possible to communicate with a service?

Nov 19 '05 #6
Sorry, here is the updated link:
http://msdn.microsoft.com/library/de...pplication.asp

There are many ways you could trigger a windows service. You can call a
method on it directly with the appropriate permissions, or you could save
information to a file or database which the windows service checks
periodically, etc.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"CK" <c_****@c-cs.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Thanks,

1. The link to windows service you posted is not found can you tell if
you meant this page?
http://msdn.microsoft.com/library/de...pplication.asp

2. can you please describe what you mean by saying "triggering a
Windows Service"? is it possible to communicate with a service?

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: JC | last post by:
Hi, I have a simple question regarding the Response.Redirect method. Does the server stop processing the ASP code as soon as it encounters the Redirect command? Or does it ever continue to...
1
by: Paul Turley | last post by:
I have a working ASP.Net application that behaves oddly only on the new production server. The vast majority of code runs behind web user controls that sit on aspx pages. On my Login_Page.aspx...
1
by: Vi | last post by:
Hi, I have a try block in which I execute a Page.Response.Redirect("myPage.aspx"); This statement always generates the exception: "Thread was being aborted" and the execution continues in the...
8
by: Mantorok | last post by:
Hi all When I start a new thread that tries to call: HttpContext.Current.Response.Redirect() It fails as Current returns null, is there anyway to access the current httpcontext from within...
1
by: MikeM | last post by:
We are getting a behavior on a Response.Redirect("SomeUrl", True) that I'm hoping someone can explain. This all refers to the code snip at the end. By the way, this is all VB ASP.NET v1.0 code. ...
5
by: Alan Silver | last post by:
Hello, I have a page that is supposed to do some checking, and if OK, set a session variable before redirecting to another page. The following code is a simplified version, I have hard-coded the...
2
by: steggun | last post by:
How To: Popup Confirmation Dialog & Redirect in LinkButton_OnClick Hello All, I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the server-side code for the LinkButton_OnClick...
56
by: UKuser | last post by:
Hi, I'm not sure if this can be done as I've searched the web and this forum. I am using an online merchant provider and I must post certain variables to their webforms through a form on my...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.