473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Contenttype with XP sp2

Hi!

I have an asp site where I have com+ components that flushes a tab separated
textfile to the client. Normally the user gets a save as dialog and can save
the file. After installing XP sp2 there seems to be problems. The user will
not be able to download the file (will not see the save as dialog either). I
don't want the document to be presented in the browser.

As it is today I have this code (the sHeader and sBody is a header and sBody
is the actual data). This is not done inside the ASP file it is done in the
COM+ component activated from an asp file.

GetObjectContext("Response").contentType = "application/save"
GetObjectContext("Response").AddHeader "Content-Disposition", "attachement;
filename=export.txt;"
GetObjectContext("Response").Write sHeader & sBody

I have tested setting contentType="text/html" and "text/plain" but this
openes the data in the browser and I need to save the file to disk. I cannot
even use right click and save target as because I have javascript validating
and setting values before the request of the export file is sent.

What I want is the save as dialog to always show.

Regards
/Hans


Jul 22 '05 #1
2 1164
> GetObjectContext("Response").AddHeader "Content-Disposition",
"attachement;

"attachment" is misspelled, s/b

GetObjectContext("Response").AddHeader "Content-Disposition", "attachment;
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Hans" <ha***@sorry.nospam.com> wrote in message
news:uC*************@TK2MSFTNGP15.phx.gbl...
Hi!

I have an asp site where I have com+ components that flushes a tab separated textfile to the client. Normally the user gets a save as dialog and can save the file. After installing XP sp2 there seems to be problems. The user will not be able to download the file (will not see the save as dialog either). I don't want the document to be presented in the browser.

As it is today I have this code (the sHeader and sBody is a header and sBody is the actual data). This is not done inside the ASP file it is done in the COM+ component activated from an asp file.

GetObjectContext("Response").contentType = "application/save"
GetObjectContext("Response").AddHeader "Content-Disposition", "attachement; filename=export.txt;"
GetObjectContext("Response").Write sHeader & sBody

I have tested setting contentType="text/html" and "text/plain" but this
openes the data in the browser and I need to save the file to disk. I cannot even use right click and save target as because I have javascript validating and setting values before the request of the export file is sent.

What I want is the save as dialog to always show.

Regards
/Hans

Jul 22 '05 #2
He-he I'm flushing! This code has been out for years (and been working) and
all the time attachment was misspelled. I changed it and it now works on XP
sp2 (I could also get it to work setting an unknown extension for the file
like export.abc).

Thanks Mark!

Regards
/Hans
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MJ | last post by:
I'm trying to stream the contenttype of "application/x-java-jnlp-file" via asp.net/c#, but the client only sees it as a plain text file. Example: Response.Clear(); Response.ClearHeader();...
5
by: TJS | last post by:
trying to display pdf file in browser fails on this line: Response.ContentType = "application/pdf" getting an error about no declaration found for "response" what declaration is needed ???
8
by: Bryan Glennon | last post by:
I have an aspx page. If I set the Response.ContentType = "application/voicexml+xml" then when I load browse to the page it downloads the file and opens .Net Studio to allow me to edit it. It...
0
by: Sean Kraft | last post by:
Hello, I am generating a PDF and writing its bytes to the browser using Response.BinaryWrite(). Before I do this I set the response.contenttype = "application/pdf". When I run in debug I see...
3
by: darrel | last post by:
I'm creating a tool for people to upload an image and have it resized on the server. I'm checking to first see if the image is a JPG, GIF, BMP or TIF file. I'm having a problem with the TIF files,...
7
by: darrel | last post by:
I'm creating a file upload tool, and want to allow only DOC, XLS, PDF, RTF or TXT files. I am using this to check: if (contentType = "application/msword") _ or (contentType = "application/rtf")...
3
by: ad | last post by:
I create a MemoryStream form a dataset: MemoryStream sm= new MemoryStream(); dsHealth.WriteXml(sm); I use Response.Write() to send this XML MemoryStream as file to client. What is the...
8
by: Katie | last post by:
Hi, I am trying to set the content type and header for the response object but for some reason it doesnt set it. I tried it on dev and it worked fine but didnot on production. The difference is...
0
by: scottf35 | last post by:
Hi, I am working on (read that - upgrading) an application. This application creates an HTTPWebRequest object, populates it with values which are then sucked out of the Request.Form object (eg...
1
by: rguarnieri | last post by:
Hi!, I'm using Visual Studio 6.0 and I'm trying to open an asp page like a .pdf file, I used Response.ContentType="application/pdf" in my asp page but it doesn't work This is an example: <%@...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.