Hi,
I have a Word document that is stored outside of the virtual server and I
need to send it to the browser. I have tried using the code below (which
seemed a little too simplistic!). The browser pops open a dialogue asking to
save a word doc but the doc is empty.
Dim f As File
f.Open("c:\test .doc", FileMode.Open)
'output file to the browser
Response.Clear( )
Response.Conten tType = "applicatio n/octet-stream; name=test.doc"
Response.AddHea der("content-transfer-encoding", "binary")
Response.AddHea der("content-disposition",
"attachment;fil ename=test.doc" )
Response.Conten tEncoding = System.Text.Enc oding.GetEncodi ng(1251)
Response.Write( f)
f.Delete("c:\te st.doc")
How to I route the document to the browser properly?
Thanks in advance,
Stuart 2 9852
Hi Stu,
Use Response.Binary Write instead Reponse.Write
Guillermo G.
--------------------------------------------------------------------------------
Guillermo González Arroyave :: MCP ASP.Net C# :: DCE4
"Stu" <s.****@cergis. com> wrote in message news:O2******** ******@tk2msftn gp13.phx.gbl...
Hi,
I have a Word document that is stored outside of the virtual server and I
need to send it to the browser. I have tried using the code below (which
seemed a little too simplistic!). The browser pops open a dialogue asking to
save a word doc but the doc is empty.
Dim f As File
f.Open("c:\test .doc", FileMode.Open)
'output file to the browser
Response.Clear( )
Response.Conten tType = "applicatio n/octet-stream; name=test.doc"
Response.AddHea der("content-transfer-encoding", "binary")
Response.AddHea der("content-disposition",
"attachment;fil ename=test.doc" )
Response.Conten tEncoding = System.Text.Enc oding.GetEncodi ng(1251)
Response.Write( f)
f.Delete("c:\te st.doc")
How to I route the document to the browser properly?
Thanks in advance,
Stuart
That worked great thanks.
"Guillermo González A." <gugonzar(arrob a)epm.net.co> wrote in message
news:Oi******** ******@TK2MSFTN GP15.phx.gbl...
Hi Stu,
Use Response.Binary Write instead Reponse.Write
Guillermo G.
Guillermo González Arroyave :: MCP ASP.Net C# :: DCE4
"Stu" <s.****@cergis. com> wrote in message
news:O2******** ******@tk2msftn gp13.phx.gbl...
Hi,
I have a Word document that is stored outside of the virtual server and I
need to send it to the browser. I have tried using the code below (which
seemed a little too simplistic!). The browser pops open a dialogue asking to
save a word doc but the doc is empty.
Dim f As File
f.Open("c:\test .doc", FileMode.Open)
'output file to the browser
Response.Clear( )
Response.Conten tType = "applicatio n/octet-stream; name=test.doc"
Response.AddHea der("content-transfer-encoding", "binary")
Response.AddHea der("content-disposition",
"attachment;fil ename=test.doc" )
Response.Conten tEncoding = System.Text.Enc oding.GetEncodi ng(1251)
Response.Write( f)
f.Delete("c:\te st.doc")
How to I route the document to the browser properly?
Thanks in advance,
Stuart This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eric Sabine |
last post by:
I have a web site where the user is able to download a file. I can't use an
anchor tag because I don't want the user to see where the filename is coming
from. Below is the code in which the user clicks to get the file. I could
swear this used to work but it definitely doesn't now. Each time at the
Response.End() method, I get a System.Threading.ThreadAbortException. I'm
not really sure why it is happening. Any clues?
Eric
Dim...
|
by: Jonas |
last post by:
Hi !
Perhaps this isn't the right group to send to, but...
I have exported my report (Crystal Report) to a stream formatted as
Word-document. Both the exporting and streaming works just fine but
when the Internet Explorer loads the document it is editable and Words
toolbar isn't visible (unlike Acrobat Reader).
So my question is whether its possible to add some information to the
|
by: Ipsita |
last post by:
Hi!
I am trying SOAP with DIME attachments in web services. For example
say, I have a file resume.pdf stored somewhere on my server. How does
the web service send the file to the client, so that the client can
store it and also read from it. I am trying out with C# and ASP.NET.
Server Side Web Method:
-----------------------
|
by: Rudy Deitrick |
last post by:
I'm displaying a Word doc on the client by streaming HTML to the client and
setting the ContentType to 'application/msword'. This works fine on our
development server (which does not use SSL), but our test server (which DOES
USE SSL) will not display the header and footer on the word doc.
I would like to know if anyone knows if SSL could be the problem with the
headers and footers not displaying.
Thanks,
Rudy Deitrick
|
by: Andrew |
last post by:
I'm adding this as it to me a while to figure out all the pieces to be
able to do this without using Microsoft.Office.Interop which caused me
problems on the web-server.
Streaming is the easy part, but I couldn't initially work out how to
manipulate the page setup to change page margins and orientation,
that's why I was looking at Microsoft.Office.Interop.
But with Microsoft.Office.Interop I couldn't fiure out how to stream
HTML...
| |
by: A.M-SG |
last post by:
Hi,
I have a ASP.NET aspx file that needs to pass large images from a network
storage to client browser. The requirement is that users cannot have access
to the network share. The aspx file must be the only method that users
receive image files.
|
by: Peter |
last post by:
Hello!
Is it possible to stream a word document to a browser via webservice? Can I
use Response.BinaryWrite method or is there some other method in webserices
to stream data? The help is very much appreciated!
Thank you!
Peter
|
by: SPG |
last post by:
Hi,
Two questions for you all..
Firstly, is there a way of streaming video using PHP? At the moment I just
have a link to a video file and the whole thing downloads before playing
which is a bit of a chore as the video file is pretty huge.
Secondly, I want to restrict access to the video using a password. Can
anyone think of a nice way of doing this? I thought about having the video
|
by: Jim Bancroft |
last post by:
Hi everyone,
We've have files we'd like to store in a SQL Server blob or text column and
make available online for our clients. Instead of linking to a document
sitting on a file server, we figure it'll be easier to manage the document
store this way.
Could someone point me to a tutorial or online docs on what classes .Net
provides for streaming bytes (I assume that's what I'll be doing) from a
database to a web browser and vice...
|
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...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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();...
|
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
| |
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...
| |