Hi. First of all, I *HAVE* to express my annoyance with how badly (at least)
this content thing is documented in MSDN. There's no head, nor tail to it.
Anyway, I have this code in a form named "Download.aspx". There's all there
is to it - no UI, nothing else. This is all the code.
__________________________________________________ _________
'Retrieve the path of the file to download, and create a FileInfo object to
read its properties
Dim strPath As String = Server.MapPath(Request.Params("File"))
Dim objFileInfo As FileInfo = New FileInfo(strPath)
'Clear the current output content from the buffer
Response.Clear()
'Add the header that specifies the default filename for the Download/SaveAs
dialog
Response.AddHeader("Content-Disposition", "attachment filename=" &
objFileInfo.Name)
'Add the header that specifies the file size, so that the browser can show
the download progress
Response.AddHeader("Content-Length", objFileInfo.Length.ToString())
'Specify that the response is a stream that cannot be read by the client and
must be downloaded
Response.ContentType = "application/octet-stream"
'Send the file stream to the client
Response.WriteFile(objFileInfo.FullName)
'Stop the execution of this page
Response.End()
__________________________________________________ _________
In another form I have for instance this anchor: <a
href="Download.aspx?File=/aspnetprojects/vsnet/ThePhile/Old.txt">
As you can see, I'm passing to Download.aspx the file Old.txt. However, the
dialog box shows the filename as being "Download.aspx" instead. Still, if I
press okay, the *CORRECT* file is downloaded, only with the wrong name
(Download.aspx instead of Old.txt). I checked my code in debug, and
objFileInfo is perfect. What can I do ? Is this a known bug ? I searched on
the net and I haven't found any fix or any bug report concerning this
behaviour.
I have IE6 with the latest and greatest updates, and XPSP2.
Thank you,
Alex 1 1459
Please disregard this message - I found the reason - I was missing a ";"
after the word "attachment"
Instead of
Response.AddHeader("Content-Disposition", "attachment filename=" &
objFileInfo.Name)
now I have
Response.AddHeader("Content-Disposition", "attachment; filename=" &
objFileInfo.Name)
and it works.
Thanks !
Alex
"Alex Nitulescu" <RE***********************@yahoo.com> wrote in message
news:uH**************@TK2MSFTNGP10.phx.gbl... Hi. First of all, I *HAVE* to express my annoyance with how badly (at least) this content thing is documented in MSDN. There's no head, nor tail to it.
Anyway, I have this code in a form named "Download.aspx". There's all there is to it - no UI, nothing else. This is all the code. __________________________________________________ _________ 'Retrieve the path of the file to download, and create a FileInfo object to read its properties Dim strPath As String = Server.MapPath(Request.Params("File")) Dim objFileInfo As FileInfo = New FileInfo(strPath)
'Clear the current output content from the buffer Response.Clear()
'Add the header that specifies the default filename for the Download/SaveAs dialog Response.AddHeader("Content-Disposition", "attachment filename=" & objFileInfo.Name)
'Add the header that specifies the file size, so that the browser can show the download progress Response.AddHeader("Content-Length", objFileInfo.Length.ToString())
'Specify that the response is a stream that cannot be read by the client and must be downloaded Response.ContentType = "application/octet-stream"
'Send the file stream to the client Response.WriteFile(objFileInfo.FullName)
'Stop the execution of this page Response.End() __________________________________________________ _________
In another form I have for instance this anchor: <a href="Download.aspx?File=/aspnetprojects/vsnet/ThePhile/Old.txt">
As you can see, I'm passing to Download.aspx the file Old.txt. However, the dialog box shows the filename as being "Download.aspx" instead. Still, if I press okay, the *CORRECT* file is downloaded, only with the wrong name (Download.aspx instead of Old.txt). I checked my code in debug, and objFileInfo is perfect. What can I do ? Is this a known bug ? I searched on the net and I haven't found any fix or any bug report concerning this behaviour.
I have IE6 with the latest and greatest updates, and XPSP2.
Thank you, Alex This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jonathan.beckett |
last post by:
Hi All,
For the past few months I have been working on an open source
Apache/PHP/MySQL content management system - and have recently made it
available for download.
It's still very much a...
|
by: jonathan.beckett |
last post by:
Hi All,
I have just made version 0.4.8 of the PluggedOut CMS Content Management
System available for download - it's free, and covered by the GPL.
It's still very much a work in progress...
|
by: Scott Abel |
last post by:
For immediate release:
The Rockley Group Content Management Workshop Series
Coming to Atlanta, Seattle, Vancouver, Chicago, Washington, DC,
Toronto, and Research Triangle Park
Learn more:...
|
by: j1c |
last post by:
How can I remove the content in between tags? I have a page that has
several custom tags: <!--tag:1--> Content 1 <!--/tag:1--> <br>
<!--tag:2--> Content 2 <!--/tag:2--> <br> <!--tag:3--> Content 3...
|
by: Richard |
last post by:
http://dynamicdrive.com/dynamicindex5/linkinfo.htm
Using the above script, I have a plan whereby when the main link is active,
two different content swaps take place.
Column A shows the main...
|
by: clintonG |
last post by:
Can somebody direct me to documents or source that supports the use of
collapsible content that is collapsed by default when the page is loaded?
The secondary objective would of course be...
|
by: xkeops |
last post by:
Thinking of creating a website, most of the pages will have a general
toolbar
menu, a content and a footer.
The content will be the only one who's gonna change but the rest
(header,footer)
will...
|
by: Managed Code |
last post by:
Hello All,
Here is my issue and thanks in advance for any assistance.
I have a base page with a dropdownlist that fires an event with
the selected index. The content page catches the event and...
|
by: dave8421 |
last post by:
Hi,
I'm trying to make sense of the definition for "Rendered Content" in
current CR for CSS 2.1
Is rendered content what is displayed on the particular media or
device? from the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
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$) {
}
...
|
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...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |