|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Strange problemI'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 Show quoteHide quote "Flurry" <cj406***@stmail.staffs.ac.uk> wrote in message news:1157715622.155464.218000@m79g2000cwm.googlegroups.com... > 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
Other interesting topics
Misterious IP -> name resolution in Uri.GetLeftPart() method
UPS LandedCost webservice and ASP.NET 1.1 ASP.NET 2.0 static variables in Global.asax web net app and Atlas questions How to get the user name after FormAuthentication insert a value in this way: <%# var %> Is Ajax.NET really so much javascript coding? Cannpot seem to add a reference in Visual Studio 2005 SIMPLE USER CONTROL PROBLEM Localization |
|||||||||||||||||||||||