473,695 Members | 3,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

download text/plain file without .txt extension

I have an aspx page that generates a file on the fly for a person to
download. It sends these http headers:

Content-Type: text/plain
Content-Disposition: attachment; filename="myfil e.lic"

The file being downloaded is a license file and MUST be stored with that
..lic extension.

If I access this aspx page with IE, it prompts me if I want to open or save
the file. I choose save, and it prompts me for a location and filename, and
the default filename is indeed myfile.lic. But when it actually saves it,
it renames it to myfile.lic.txt.

Very frustrating! Incidentally, IE behaves this way, Firefox does not.
Firefox saves the file with the name I specified.

As a user, when I choose to save the file, I can force IE to use the exact
filename I want by surrounding it with double quotes: "myfile.lic ". Then
the .txt doesn't get tacked on. But I can't force those extra quotes on
there in the Content-Disposition line.

Anyone have a solution?
Nate
Nov 19 '05 #1
3 2759
On Wed, 22 Jun 2005 11:31:14 -0600, "Nate Hekman" <he************ *********@nospa m.com> wrote:

¤ I have an aspx page that generates a file on the fly for a person to
¤ download. It sends these http headers:
¤
¤ Content-Type: text/plain
¤ Content-Disposition: attachment; filename="myfil e.lic"
¤
¤ The file being downloaded is a license file and MUST be stored with that
¤ .lic extension.
¤
¤ If I access this aspx page with IE, it prompts me if I want to open or save
¤ the file. I choose save, and it prompts me for a location and filename, and
¤ the default filename is indeed myfile.lic. But when it actually saves it,
¤ it renames it to myfile.lic.txt.
¤
¤ Very frustrating! Incidentally, IE behaves this way, Firefox does not.
¤ Firefox saves the file with the name I specified.
¤
¤ As a user, when I choose to save the file, I can force IE to use the exact
¤ filename I want by surrounding it with double quotes: "myfile.lic ". Then
¤ the .txt doesn't get tacked on. But I can't force those extra quotes on
¤ there in the Content-Disposition line.
¤
¤ Anyone have a solution?

If I remember correctly IE does this for unknown file types. You might want to try registering the
..lic file extension with an application to see if it resolved the problem.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 19 '05 #2
That does resolve the problem, but it's not an acceptable solution to me.
It would work going forward but I need to deliver these license files to a
large number of customers who already have our software installed, and I
don't want them to have to run something else first to register the file
type before they can download the license files.

I have found that if I change the Content-Type to something non-standard,
such as:

Content-Type: application/mylicfile

IE no longer tries to tack on the .txt extension. Firefox and Netscape
continue to work correctly too. But am I breaking some standard by
manufacturing my own custom Content-Type? Will I run into trouble somewhere
else (perhaps some firewalls will filter out unknown content-types)?
Nate

P.S. If you know of a better forum to be asking these questions, please
suggest one.
"Paul Clement" <Us************ ***********@sws pectrum.com> wrote in message
news:oe******** *************** *********@4ax.c om...
On Wed, 22 Jun 2005 11:31:14 -0600, "Nate Hekman"
<he************ *********@nospa m.com> wrote:

¤ I have an aspx page that generates a file on the fly for a person to
¤ download. It sends these http headers:
¤
¤ Content-Type: text/plain
¤ Content-Disposition: attachment; filename="myfil e.lic"
¤
¤ The file being downloaded is a license file and MUST be stored with that
¤ .lic extension.
¤
¤ If I access this aspx page with IE, it prompts me if I want to open or
save
¤ the file. I choose save, and it prompts me for a location and filename,
and
¤ the default filename is indeed myfile.lic. But when it actually saves
it,
¤ it renames it to myfile.lic.txt.
¤
¤ Very frustrating! Incidentally, IE behaves this way, Firefox does not.
¤ Firefox saves the file with the name I specified.
¤
¤ As a user, when I choose to save the file, I can force IE to use the
exact
¤ filename I want by surrounding it with double quotes: "myfile.lic ".
Then
¤ the .txt doesn't get tacked on. But I can't force those extra quotes on
¤ there in the Content-Disposition line.
¤
¤ Anyone have a solution?

If I remember correctly IE does this for unknown file types. You might
want to try registering the
.lic file extension with an application to see if it resolved the problem.
Paul
~~~~
Microsoft MVP (Visual Basic)

Nov 19 '05 #3
On Wed, 22 Jun 2005 12:06:49 -0600, "Nate Hekman" <he************ *********@nospa m.com> wrote:

¤ That does resolve the problem, but it's not an acceptable solution to me.
¤ It would work going forward but I need to deliver these license files to a
¤ large number of customers who already have our software installed, and I
¤ don't want them to have to run something else first to register the file
¤ type before they can download the license files.
¤
¤ I have found that if I change the Content-Type to something non-standard,
¤ such as:
¤
¤ Content-Type: application/mylicfile
¤
¤ IE no longer tries to tack on the .txt extension. Firefox and Netscape
¤ continue to work correctly too. But am I breaking some standard by
¤ manufacturing my own custom Content-Type? Will I run into trouble somewhere
¤ else (perhaps some firewalls will filter out unknown content-types)?
¤

Could you use Response.AddHea der to specify the Content-Disposition value? I don't think it would
cause any issues using a custom Content-Type

¤ P.S. If you know of a better forum to be asking these questions, please
¤ suggest one.

I wouldn't consider myself an ASP expert so you may also want to try the
microsoft.publi c.inetserver.as p.general newsgroup as well to see if there are any other known
workarounds.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 19 '05 #4

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

Similar topics

3
1770
by: D. Alvarado | last post by:
Hello, I have a page that generates a text file (but writes the file with the ".csv" extension) and then I redirect the user so he can save the file header("Location: $my_csv_file"); However, the file appears as text in the browser and I would prefer that the gray "Download this file" box pop up. How could I pull this off, or is this really more dependent on client browser settings?
7
1877
by: Daedalus | last post by:
Hi, I have made a php page where people can configure a javascript online with a preview and then dowload the result. Here is the code: <? // Some code that create a temp file ($file handler = $fd) and write the script // Send the file header("content-type: text/plain"); header("Content-length: ".filesize($file)); header('Content-Disposition: attachment; filename="script_name.js"');
4
4132
by: hoke | last post by:
I want to display plain text files in the browser. The files contain html and javascript and have a .txt extension. This works fine with files with just html. Unfortunately when showing files with javascript, I get an "error on page" warning and the page is not displayed. I suppose that when Internet Explorer discovers a <script> tag he starts to interpret it. This is not what I want. After all Internet Explorer is a browser and not an...
5
3374
by: Thomas Andersson | last post by:
Hi, I am trying to find a working solution for download of large files (400-800 MB)... But this seems almost impossible to find a working example. I have tried Response.Transmitfile, this works for some people…but in my case the server reset the connection after approx. 20 minutes and sometimes after 7-8 minutes…the download speed is however very good 400MB takes about 10
0
1322
by: Showjumper | last post by:
I set up a download tracker. When i first tested it, all was fine. However as i just found out via an email, the zip file is corrupt. Folks can download the file but it just cant be opened. The download code appears to work fine as far as logging the user and sending the file (as far as i can tell) but my guess is that there is a problem with the download tracker that is corrupt ing the file because the file is fine onmy local drive. Any...
0
1738
by: Rhys666 | last post by:
Basically I have a link that opens my download page and the querystring identifies the type of 'template' Excel spreadsheet has asked to download. The download page reads the querystring, identifies the template required then uses Response.AppendHeader to amend the response to create the file download dialogue. On my local machine this works fine and the download dialogue correctly identifies the file name and type attempting to be...
5
5275
by: Baren | last post by:
Hi! I am using impersonate="true" to upload and download files from a network share. I have created common users on both the webserver and the file server. The user has permission to the files server folder. I am able to upload the files into the fileserver, but while downloading the same i am getting error "file doesn't exist" and the path it shows is localhost temporary internet files.
7
1721
by: toby989 | last post by:
Hi All Sorry for reposting...the entries of the post from 11/23/2005 by Eric Lindsay have been removed from the server already and I am seeing only the header. So, I have the problem of including via SSI a plain text fixed width table (separated by spaces) which of course gets treated as html when doing that. I would like to have the blanks (and line returns) stay in the file and then I could use courier new to display it properly. I
16
3248
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will not print in the username or email amddress of the person doing the download - which I am collecting from a form on the previous page. I can get the name and email address to print out normally, just not into the email sending body. I have...
0
8640
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8582
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7672
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4348
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3018
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1984
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.