The client I am currently working is using a thrid party framework to
generate web content, this framework utilizes asp.net web services I have
written for them, one of these web services streams the contents of file for
download by the end user.
My question is how do I write the following bit of code as pure HTML so that
the web service can return the complete HTML script required to download the
file so that the third party then can display the HTML a they require, hope
this makes sense...
The code lets the user download a txt file when the asp.net page is loaded
or a button is click, but what is the HTML output for this?
FileStream fileStream = new FileStream("C:\\XXXXX\\Test.txt", FileMode.Open,
FileAccess.Read);
long fileSize;
fileSize = fileStream.Length;
byte[] buffer = new byte[(int)fileSize];
fileStream.Read(buffer, 0, (int)fileSize);
fileStream.Close();
Response.ContentType = "application/txt";
Response.AddHeader( "content-disposition", "attachment;
filename=RJL00102.x01");
Response.BinaryWrite(buffer);
Cheers in advance
Ollie 2 999
"Ollie" <ol**********@hotmail.com> wrote in message news:uu**************@TK2MSFTNGP10.phx.gbl... The client I am currently working is using a thrid party framework to generate web content, this framework utilizes asp.net web services I have written for them, one of these web services streams the contents of file for download by the end user.
My question is how do I write the following bit of code as pure HTML so that the web service can return the complete HTML script required to download the file so that the third party then can display the HTML a they require, hope this makes sense...
The code lets the user download a txt file when the asp.net page is loaded or a button is click, but what is the HTML output for this?
FileStream fileStream = new FileStream("C:\\XXXXX\\Test.txt", FileMode.Open, FileAccess.Read); long fileSize; fileSize = fileStream.Length; byte[] buffer = new byte[(int)fileSize]; fileStream.Read(buffer, 0, (int)fileSize); fileStream.Close(); Response.ContentType = "application/txt"; Response.AddHeader( "content-disposition", "attachment; filename=RJL00102.x01"); Response.BinaryWrite(buffer);
Cheers in advance
Ollie
One note: I'm not sure fileStream.Read(buffer, 0, (int)fileSize);
is guaranteed to read exactly fileSize bytes.
Your should just output the contents of the file (along with an http-header),
it shouldn't add extra html (you did remove everything except directives
from the aspx file?).
If the file really exists on disk, you could also look at the
HttpResponse.WriteFile method.
Hans Kesting
cheers but you total missed the point
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl... "Ollie" <ol**********@hotmail.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl... The client I am currently working is using a thrid party framework to generate web content, this framework utilizes asp.net web services I
have written for them, one of these web services streams the contents of file
for download by the end user.
My question is how do I write the following bit of code as pure HTML so
that the web service can return the complete HTML script required to download
the file so that the third party then can display the HTML a they require,
hope this makes sense...
The code lets the user download a txt file when the asp.net page is
loaded or a button is click, but what is the HTML output for this?
FileStream fileStream = new FileStream("C:\\XXXXX\\Test.txt",
FileMode.Open, FileAccess.Read); long fileSize; fileSize = fileStream.Length; byte[] buffer = new byte[(int)fileSize]; fileStream.Read(buffer, 0, (int)fileSize); fileStream.Close(); Response.ContentType = "application/txt"; Response.AddHeader( "content-disposition", "attachment; filename=RJL00102.x01"); Response.BinaryWrite(buffer);
Cheers in advance
Ollie
One note: I'm not sure fileStream.Read(buffer, 0, (int)fileSize); is guaranteed to read exactly fileSize bytes.
Your should just output the contents of the file (along with an
http-header), it shouldn't add extra html (you did remove everything except directives from the aspx file?).
If the file really exists on disk, you could also look at the HttpResponse.WriteFile method.
Hans Kesting
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Xah Lee |
last post by:
with strict HTML spec, can one have <p> tags inside table's <td> tag?
also, in strict XHTML, can one have <p> tages inside <div>?
Thanks.
Xah
xah@xahlee.org
∑ http://xahlee.org/
|
by: Frances Del Rio |
last post by:
hello all, I have a question that is not striclty a JS question but
figured folks here would know..
what IS the difference between Netscape and mozilla?? I have used
both, they have the same...
|
by: MLH |
last post by:
Is the Between ... And operator strictly reserved for use in SQL?
|
by: Ollie |
last post by:
The client I am currently working is using a thrid party framework to
generate web content, this framework utilizes asp.net web services I have
written for them, one of these web services streams...
|
by: Mike |
last post by:
I'm trying to create a page: Three sections (left, topright and
bottomright), each with a heading and scrolling (overflow) content.
The size of these sections should be based upon the size of the...
|
by: Tony Girgenti |
last post by:
Hello.
When i develop a web form program using VS.NET 2003(VB), ASP.NET 1.1, i can
put a statement like this in my VB code-behind source file:
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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...
| |