Word automation

  • Thread starter Thread starter Joe Lalor
  • Start date Start date
J

Joe Lalor

I am trying to automatically open a word document in an asp.net application. It
works fine on the local host, but when I deploy on a W2003 server, the
winword process starts (I can see it in the task manager on the server), but
the document doesn't open on the client. If I define the document as the
target of a hyperlink on my asp.net page, it opens fine when I click on it.
I've
tried using :

System.Diagnostics.Process.Start("c:\test.DOC")

(System.Diagnostics.Process.Start("notepad.exe") also doesn't work)

and

Batch.appWord = New Word.Application

Batch.docWord = Batch.appWord.Documents.Open("c:\test.doc")

What am I doing wrong?

Thanks
 
re:
!> I am trying to automatically open a word document in an asp.net application. It
!> works fine on the local host, but when I deploy on a W2003 server, the
!> winword process starts (I can see it in the task manager on the server), but
!> the document doesn't open on the client.

If you check your *server* you'll see that it opens on the server.
ASP.NET runs on the server, not on the client.

re:
!> If I define the document as the target of a hyperlink
!> on my asp.net page, it opens fine when I click on it.

Yes.

Hyperlinks are sent to the client as HTML, and it's the
client which initiates the process when the link is clicked.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
A web server cannot create a process on the client machine. Depending on
what you are doing, I would get the user to upload the word file, run
whatever processing you need to, and then let them download a modified file.

Marc
 
Response.Redirect("<url of the word document>");

Or in the page class create a member variable: string docurl = "<url of the
word documet>";
Then use javascript on the OnLoad event to open a new window with that URL.
 
Back
Top