Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open doc from URL using dsofile

Status
Not open for further replies.

Leonos

Programmer
Sep 17, 2003
32
NL
Hi,

I want to open a word document located on my webserver using the dsofile object from microsoft, but I can't get it to open the file.

I can get it to work when I use my local drive as the location of the document :
MyWordFile.Open("c://mydocs//document.doc", false, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess), but that's not what I want :)

grtz
Leoni

 
You can use either relative or absolute path here.
Documentation for the Directory class:
In members that accept a path, the path can refer to a file or just a directory. The specified path can also refer to a relative path or a Universal Naming Convention (UNC) path for a server and share name. For example, all the following are acceptable paths:
- "c:\\MyDir" in C#, or "c:\MyDir" in Visual Basic.
- "MyDir\\MySubdir" in C#, or "MyDir\MySubDir" in Visual Basic.
- "\\\\MyServer\\MyShare" in C#, or "\\MyServer\MyShare" in Visual Basic.
Take a look at following links too...
File custom attributes
http://support.microsoft.com:80/support/kb/articles/Q224/3/51.ASP&NoWebContent=1]Dsofile.dll[/url]

Sharing the best from my side...

--Prashant--
 
Well, I'm not opening from a UNC path so that was the problem.
But I have managed to get it to work.
Someone should hit me with a stick, because the answer was so simple..

Is had to use the Server.MapPath offcourse to get it to work.

.Open(Server.MapPath("~/App_Data/document.doc",false,...)

Easy actually.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top