473,802 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Redire ct("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.Clos e(); 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 2638
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.goo glegroups.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.Redire ct("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.Clos e(); 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.goo glegroups.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.Redire ct("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.Clos e(); 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******** *************@g 14g2000cwa.goog legroups.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******** *************@l 41g2000cwc.goog legroups.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
3063
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 process the page? Basically, with the following code: Response.Redirect("../newpage.asp")
1
8308
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 page, user enters user name, password, etc into controls on the contained Login_Control.ascx and clicks a button that redirects them to another page (i.e. Response.Redirect("Main_Menu_Page.aspx").) Instead of redirecting, the browser window is...
1
1770
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 catch block. Is there a way to execute Page.Response.Redirect without generating this exception? Or if not, is there at least a way to ignore this exception in the code? Thank you.
8
2174
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 a new thread? Thanks
1
2747
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. So we have the Page_Load event of an ASPX page fire which in the snip you see calls "SomeMethod". Also you see in Page_Load two Catch statements. The first is "SpecialException". We created our own extended exception (inherits from...
5
2033
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 basket ID and removed a load of extra checking... public partial class GoToCheckout : Page { public void Page_Load(Object o, EventArgs e) { try {
2
8997
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 event, I need to do some processing and, if it succeeds, popup a confirmation dialog and redirect to a different page. How can I do this? Here's some pseudo-code:
56
7249
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 website. The issue is that I need to gauge whether a user has any items in their basket to decide which page I redirect them too. I could
9
4351
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). The browser then makes a new request to the server to redirect itself to abcd.asp after which the user gets redirected to abcd.asp. But in case of Server.Execute (or Server.Transfer), when the server
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9114
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.