I've got a problem and I'm not getting much help trying to resolve it.
I've searched google all morning for an answer...
I have the following code:
Lab1.text = "Your Serial Number is: "
Lab2.text = serialNo & "-" & serialYY
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment;
filename=" & fname)
Response.ContentType = "txt, doc, jpg"
Response.WriteFile(path)
which is supposed to output a serial number in two labels and then
download a file. The problem is that when I put the code to download
the file, the serial number is not displayed on the page.
To recap and make sure everything is clear. Without the download code
the labels get set correctly. When I put the download code in, the file
downloads correctly but the labels are never set.
Can someone explain what is going on??
Many thanks...It's a single response...you can't both stream normal html and biarny data
on it. It's a basic http/web thing. It's why if you go visit an image in
your browser, say, http://www.google.com/intl/en/images/logo.gif you'll
never see plain text as well as the image.
One solution might be to load the page, display your 2 labels, and use a
javascript to redirect to downloadSomeFile.aspx downloadSomeFile.aspx
would let the user download the file, while the page would stay where it is
since no new html stream was received.
Karl
--
http://www.openmymind.net/
http://www.codebetter.com/
"Flurry" <cj406168@.stmail.staffs.ac.ukwrote in message
news:1157715622.155464.218000@.m79g2000cwm.googlegr oups.com...
Quote:
Originally Posted by
Hello
>
I've got a problem and I'm not getting much help trying to resolve it.
I've searched google all morning for an answer...
>
I have the following code:
>
Lab1.text = "Your Serial Number is: "
Lab2.text = serialNo & "-" & serialYY
>
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment;
filename=" & fname)
Response.ContentType = "txt, doc, jpg"
Response.WriteFile(path)
>
which is supposed to output a serial number in two labels and then
download a file. The problem is that when I put the code to download
the file, the serial number is not displayed on the page.
>
To recap and make sure everything is clear. Without the download code
the labels get set correctly. When I put the download code in, the file
downloads correctly but the labels are never set.
>
Can someone explain what is going on??
>
Many thanks...
>
Response.ContentType = "txt, doc, jpg"
ContentType should be a *MIME type*, like "text/plain",
"application/msword", "image/jpeg", not the file-extension.
See http://www.ltsw.se/knbase/internet/mime.htp
Hans Kesting
0 comments:
Post a Comment