469,600 Members | 2,326 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,600 developers. It's quick & easy.

Please wait...

Hello,

I am generating a pdf file via some code. It takes
approx. 30 secs to create the pdf and to show it to the
user. During that time, I want to show a message
like "Please Wait...". Ideally I would like to show only
this message in some kind of messagebox and show the pdf
page only when the processing has been finished. However I
dont know how to do that. What I tried was the following:

I hardcoded the string "Please wait..." In the same page,
where I create the pdf. However when the pdf is going to
run, then I get the message:

System.Web.HttpException: Server cannot set content type
after HTTP headers have been sent.

I was using this code:

Dim context As System.Web.HttpContext =
System.Web.HttpContext.Current
Dim response As System.Web.HttpResponse = context.Response
response.Clear()
response.ContentType = "application/pdf"
pdfDocument.Generate(response.OutputStream)
response.End()

Can anybody please guide me on what to do here?

Thanks
Nov 19 '05 #1
4 1922
For a please wait, try:
http://blogs.crsw.com/mark/articles/642.aspx

You should try to add Response.ClearHeaders() for your specific problem...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anonymous" <an*******@discussions.microsoft.com> wrote in message
news:14****************************@phx.gbl...
Hello,

I am generating a pdf file via some code. It takes
approx. 30 secs to create the pdf and to show it to the
user. During that time, I want to show a message
like "Please Wait...". Ideally I would like to show only
this message in some kind of messagebox and show the pdf
page only when the processing has been finished. However I
dont know how to do that. What I tried was the following:

I hardcoded the string "Please wait..." In the same page,
where I create the pdf. However when the pdf is going to
run, then I get the message:

System.Web.HttpException: Server cannot set content type
after HTTP headers have been sent.

I was using this code:

Dim context As System.Web.HttpContext =
System.Web.HttpContext.Current
Dim response As System.Web.HttpResponse = context.Response
response.Clear()
response.ContentType = "application/pdf"
pdfDocument.Generate(response.OutputStream)
response.End()

Can anybody please guide me on what to do here?

Thanks

Nov 19 '05 #2
This is simplest solution I've seen:
http://www.aspnetpro.com/NewsletterA...200308bm_l.asp

--
I hope this helps,
Steve C. Orr, MCSD
http://SteveOrr.net
"Anonymous" <an*******@discussions.microsoft.com> wrote in message
news:14****************************@phx.gbl...
Hello,

I am generating a pdf file via some code. It takes
approx. 30 secs to create the pdf and to show it to the
user. During that time, I want to show a message
like "Please Wait...". Ideally I would like to show only
this message in some kind of messagebox and show the pdf
page only when the processing has been finished. However I
dont know how to do that. What I tried was the following:

I hardcoded the string "Please wait..." In the same page,
where I create the pdf. However when the pdf is going to
run, then I get the message:

System.Web.HttpException: Server cannot set content type
after HTTP headers have been sent.

I was using this code:

Dim context As System.Web.HttpContext =
System.Web.HttpContext.Current
Dim response As System.Web.HttpResponse = context.Response
response.Clear()
response.ContentType = "application/pdf"
pdfDocument.Generate(response.OutputStream)
response.End()

Can anybody please guide me on what to do here?

Thanks

Nov 19 '05 #3
I already tried to clear the headers, but it says:

Cant clear header after it has been set.
-----Original Message-----
For a please wait, try:
http://blogs.crsw.com/mark/articles/642.aspx

You should try to add Response.ClearHeaders() for your specific problem...
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more tocome!)
"Anonymous" <an*******@discussions.microsoft.com> wrote in messagenews:14****************************@phx.gbl...
Hello,

I am generating a pdf file via some code. It takes
approx. 30 secs to create the pdf and to show it to the
user. During that time, I want to show a message
like "Please Wait...". Ideally I would like to show only
this message in some kind of messagebox and show the pdf
page only when the processing has been finished. However I dont know how to do that. What I tried was the following:
I hardcoded the string "Please wait..." In the same page, where I create the pdf. However when the pdf is going to
run, then I get the message:

System.Web.HttpException: Server cannot set content type
after HTTP headers have been sent.

I was using this code:

Dim context As System.Web.HttpContext =
System.Web.HttpContext.Current
Dim response As System.Web.HttpResponse = context.Response response.Clear()
response.ContentType = "application/pdf"
pdfDocument.Generate(response.OutputStream)
response.End()

Can anybody please guide me on what to do here?

Thanks

.

Nov 19 '05 #4
Hello Anonymous,

You can not intermix a PDF and HTML in the same window... This is where your
problem is coming from. You're sending content to the browser and then sending
the PDF which has a different content type header (application/pdf).

--
Matt Berther
http://www.mattberther.com
I already tried to clear the headers, but it says:

Cant clear header after it has been set.
-----Original Message-----
For a please wait, try:
http://blogs.crsw.com/mark/articles/642.aspx
You should try to add Response.ClearHeaders() for your

specific problem...
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the

popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup

FAQ (more to
come!)

"Anonymous" <an*******@discussions.microsoft.com> wrote

in message
news:14****************************@phx.gbl...
Hello,

I am generating a pdf file via some code. It takes
approx. 30 secs to create the pdf and to show it to the
user. During that time, I want to show a message
like "Please Wait...". Ideally I would like to show only
this message in some kind of messagebox and show the pdf
page only when the processing has been finished. However I
dont know how to do that. What I tried was the
following:
I hardcoded the string "Please wait..." In the same
page,
where I create the pdf. However when the pdf is going to run, then I
get the message:

System.Web.HttpException: Server cannot set content type after HTTP
headers have been sent.

I was using this code:

Dim context As System.Web.HttpContext =
System.Web.HttpContext.Current
Dim response As System.Web.HttpResponse = context.Response
response.Clear()
response.ContentType = "application/pdf"
pdfDocument.Generate(response.OutputStream)
response.End()
Can anybody please guide me on what to do here?

Thanks

.

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Danny Masti | last post: by
4 posts views Thread by dave | last post: by
5 posts views Thread by Chris | last post: by
4 posts views Thread by puja patel | last post: by
1 post views Thread by =?Utf-8?B?Sm9obiBXYWxrZXI=?= | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.