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

J

Julia

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.
 
G

Guest

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!
***************************
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top