Please wait...

A

Anonymous

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
 
A

Anonymous

I already tried to clear the headers, but it says:

Cant clear header after it has been set.
 
M

Matt Berther

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

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top