Opening a Word Document in a browser (C#)

  • Thread starter Thread starter Walter Levine
  • Start date Start date
W

Walter Levine

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.doc"

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

(e-mail address removed)
 
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


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.doc"

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

(e-mail address removed)

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.
 
Back
Top