473,587 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening a Word Document in a browser (C#)

I just worked through a VB.Net sample program that creates an rft document
and then opens it in Word. The code that opens the document is:
Dim sFileName As String

sFileName = "Sample1.do c"

Response.Write( "<META HTTP-EQUIV=""REFRESH "" Content=""0;URL =" & sFileName
& """>")

I cannot get this to work in C#, can anybody show me how to construct this
statement in C#. Also, where can I find some documentation about how this
works

Thanks in advance for any help.

Walter

wl*****@sigsys. net


Nov 16 '05 #1
1 4364

That's not a good way to do it. It'd be better to set the
content-type and content-disposition headers and then stream the doc
out to the response directly.

The meta refresh thing is using a client-side HTML redirect which
requires a second round-trip to the server. Besides that, an HTTP
redirect would be cleaner (but still require a redirect).

HTH,

Sam
On Wed, 16 Mar 2005 11:12:52 -0500, "Walter Levine"
<wl*****@sigsys .net> wrote:
I just worked through a VB.Net sample program that creates an rft document
and then opens it in Word. The code that opens the document is:
Dim sFileName As String

sFileName = "Sample1.do c"

Response.Write ( "<META HTTP-EQUIV=""REFRESH "" Content=""0;URL =" & sFileName
& """>")

I cannot get this to work in C#, can anybody show me how to construct this
statement in C#. Also, where can I find some documentation about how this
works

Thanks in advance for any help.

Walter

wl*****@sigsys .net


B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
Nov 16 '05 #2

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

Similar topics

2
1869
by: RandyB | last post by:
I built a web app that creates and saves a WordML file on disk (with a processing instruction in it for Word.Document). When this file is requested from a client machines, the client's browser automatically opens Word 2003 and views the XML in the Word application as a document, as its supposed to. However, on one machine, the XML text just...
3
5572
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge document in Word; 2. opens the document and runs the merge process for the new data. I have managed to write the code to perform step 1 ok, but I'm...
3
6113
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone done this? Does it seem possible? I followed the instructions from a sample on the Microsoft knowledge base but it only seems to work when creating...
4
1742
by: Thomas Scheiderich | last post by:
I can't seem to open a word document from any of my browsers except the one on my web server. Here is the .aspx file: ***************************************************************** <%@ Import Namespace="System.Data.SqlClient" %> <%@ import Namespace="System.IO" %> <Script Runat="Server">
3
5927
by: richi | last post by:
Hello, i'm hoping that somebody can point me in the right direction with my problem. I have been tasked with creating a simple browser based application that will allow the user to upload Word documents to SQL Server and then retrieve them when needed. Storing the Word document seems to be no problem but where I am stuck is on retrieving...
4
2025
by: enak | last post by:
I need to open a Word template so that I can merge some data from a database with the document. I am using ASP.NET, VB.NET. I can not even get MS Word to be visible. I can see that an instance is created in Task Manager. Here is my code: Private Sub createReport() Dim missing As Object = System.Reflection.Missing.Value Dim file_name As...
2
3369
by: Colin Halliday | last post by:
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge. If I open this doc using the Word GUI, it first asks me to confirm that I want to run a query to select the data from the data source file, then it opens the form letter fine. I can preview the merged records and...
5
2558
by: Cedric | last post by:
Hi Folks, I'm wondering if someone has already succeed to open a word2000 document located on server side with javascript code executed by a web browser on client side. In fact, i make it without any problem when the client use Word XP & 2003 but no result with Word 2000. Any suggestions are welcomed,
1
2168
by: captainwin | last post by:
Here's the problem: - Website is ASP.NET 1.0 - Server is Windows Server 2003 - Browser is IE 6/7 - Client requests a mail merged MS Word 97 - 2003 document on the website, and the document gets created on the server. - Need to send the document to the client browser and delete the file from the server. Previously, the web application...
2
2809
by: icewalker | last post by:
Hi I have been trying to open a new window in Word/OO Writer with JS using the following code (and numerous variations I could add...): tw = window.open('about:blank',''); tw.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'); tw.document.writeln('<HTML><HEAD>'); tw.document.writeln('Content-type:...
0
7923
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...
0
8216
Oralloy
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. ...
0
8349
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7974
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...
0
8221
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...
0
3845
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...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
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
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.