473,320 Members | 1,600 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,320 software developers and data experts.

How to display a message in ASP.NET page during long task?



Hi,

My ASP.NET send an email and it is taking some time,
I would like to display a message to the user

Here is my code

Response.Write(Configuration.AppSettings["message"]);

Response.Flush();

//Send the email

EmailDispatcher dispatcher=new EmailDispatcher();

dispatcher.Execute( this.Request.QueryString["pwd"],this.Request.Form);

i understand that that is wrong since i get an error saying that i cannot
redirect afterh HTTP headers was sent

Thanks in advance.


Nov 18 '05 #1
2 1221
Thanks
I am using client side script to do the redirect.

"Julia" <co********@012.net.il> wrote in message
news:el**************@TK2MSFTNGP14.phx.gbl...


Hi,

My ASP.NET send an email and it is taking some time,
I would like to display a message to the user

Here is my code

Response.Write(Configuration.AppSettings["message"]);

Response.Flush();

//Send the email

EmailDispatcher dispatcher=new EmailDispatcher();

dispatcher.Execute( this.Request.QueryString["pwd"],this.Request.Form);

i understand that that is wrong since i get an error saying that i cannot
redirect afterh HTTP headers was sent

Thanks in advance.

Nov 18 '05 #2
You cannot do a Response.Redirect after sending anything to the client. Once
you Response.Write, you are hosed on this.

The solution is to Response.Write, then Flush(), but do not finish the page.
When the email is sent, Write a JavaScript block to the client to redirect to
a new page.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Julia" wrote:


Hi,

My ASP.NET send an email and it is taking some time,
I would like to display a message to the user

Here is my code

Response.Write(Configuration.AppSettings["message"]);

Response.Flush();

//Send the email

EmailDispatcher dispatcher=new EmailDispatcher();

dispatcher.Execute( this.Request.QueryString["pwd"],this.Request.Form);

i understand that that is wrong since i get an error saying that i cannot
redirect afterh HTTP headers was sent

Thanks in advance.


Nov 18 '05 #3

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

Similar topics

5
by: Homa | last post by:
Hi all, Can anyone give me some links about how to do an async web service call from aspx and display a temperary page before the web service returns? Thanks, Homa Wong
14
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So,...
4
by: Mantorok | last post by:
Hi ASP.Net v2.0 I have a page and, depending on circumstances, it can sometimes take between 10-30 seconds to load, this is due to a dependency on a 3rd party web-service that is very slow.....
4
by: Simon | last post by:
If I am running a long time query, how to show a wait page at then? Is there any recommended way to do it? Thanks.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.