473,320 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

open word doc from the server on the cients pc

ton
Hi,

I'm creating an application and I want to give users access to saved Word
documents on the server. How can I establish this.

I prefer to open specific Word documents directly into word on the client
but if it is in a (different) browser it is ok.

I've tried:
<A HREF="Websitefolder/systeemAT.doc">systeemAT.doc</A>

but I received an error:

Server Error in '/WebSite2' Application.
--------------------------------------------------------------------------------

HTTP Error 403 - Forbidden
Version Information: ASP.NET Development Server 8.0.0.0

I prefer to give acces to a folder on a different disk on the server

thanx

Ton

Aug 22 '08 #1
4 1667
"ton" <to*@nospam.nlwrote in message
news:a9**************************@cache3.tilbu1.nb .home.nl...
Hi,

I'm creating an application and I want to give users access to saved Word
documents on the server. How can I establish this.

I prefer to open specific Word documents directly into word on the client
but if it is in a (different) browser it is ok.

I've tried:
<A HREF="Websitefolder/systeemAT.doc">systeemAT.doc</A>

but I received an error:

Server Error in '/WebSite2' Application.
--------------------------------------------------------------------------
------
>
HTTP Error 403 - Forbidden
Version Information: ASP.NET Development Server 8.0.0.0

I prefer to give acces to a folder on a different disk on the server

Unless you are testing ASP.NET related code its not a good idea to test
things using the development server.

Try this using IIS and see what happens.

--
Anthony Jones - MVP ASP/ASP.NET
Aug 22 '08 #2
Try the following idea:

1. Read the file and get is into a Byte[]
2. PLay with the context object

!!! Set the ContentType to "application.msword" for Word Documents,
see the internet for other applications

An example. Is used this example on http://www.getMyVCard.com,
ofcourse I changed the ContentType :)
Byte[] byteArray = the file readed;

Context.Response.Clear();
Context.Response.ContentType = "application/msword";
Context.Response.AddHeader("Content-Disposition", " filename=" +
"filename.doc");
Context.Response.AddHeader("Content-Length",
byteArray.Length.ToString());
Context.Response.BinaryWrite(byteArray);
Context.Response.Flush();
I hope this bring you into the good direction

Frederik Van Lierde
http://www.SilverSandsAssociates.com
http://BlueBizTalk.blogspot.com
Aug 22 '08 #3
"Frederik Van Lierde" <fr******@blueoceansgroup.comwrote in message
news:df**********************************@y21g2000 hsf.googlegroups.com...
Try the following idea:

1. Read the file and get is into a Byte[]
2. PLay with the context object

!!! Set the ContentType to "application.msword" for Word Documents,
see the internet for other applications

An example. Is used this example on http://www.getMyVCard.com,
ofcourse I changed the ContentType :)
Byte[] byteArray = the file readed;

Context.Response.Clear();
Context.Response.ContentType = "application/msword";
Context.Response.AddHeader("Content-Disposition", " filename=" +
"filename.doc");
Context.Response.AddHeader("Content-Length",
byteArray.Length.ToString());
Context.Response.BinaryWrite(byteArray);
Context.Response.Flush();
I hope this bring you into the good direction
Not really. If you've got static content sitting in your site its
preferable to have IIS static content handler deliver it.

If the word document is 40MBs how much memory is needed for the code above?
If the user revisits the document do they get a cached version or does the
server have to do all that again?

BTW, what purpose does the Flush serve? What would happen if it were not
there?

--
Anthony Jones - MVP ASP/ASP.NET
Aug 22 '08 #4
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:uD**************@TK2MSFTNGP04.phx.gbl...
>Context.Response.Flush();

BTW, what purpose does the Flush serve?
None, since it's the last line of the routne anyway.
What would happen if it were not there?
Nothing different.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 22 '08 #5

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

Similar topics

6
by: Jason Huang | last post by:
Hi, Using C# web form in ASP.Net, how to open a MS Word application? Thanks for help. Jason
2
by: Todd | last post by:
Ok, this code works fine on the Web server machine. But when I try to run it via any other clients on the LAN, I keep getting scripting errors (the MS Word Document never opens.) Do I have to...
3
by: grzybek | last post by:
Hi, I upload files to ma Web Server and then I can view those files as link. I'd like to be able to open those file in proper application on client PC. I want achieve the same result as though...
1
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...
0
by: senthilavs | last post by:
Hi, Im having word document in the Server Machine. While im trying to open the file in Client Machine file is opening in Server only. I need to open in the client only. This is an ASP.NET project...
0
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want...
7
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear();...
2
by: saketmayur | last post by:
Hi , I have write the following code to open word document on server using Microsoft.Office.Interop.Word; string DocPath = System.Configuration.ConfigurationManager.AppSettings; ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.