|
-
Apr 17th, 2003, 11:14 AM
#1
Thread Starter
Lively Member
Problem using WriteFile with files stored on other servers?
I have an ASP.NET site in which I need to binary-write the contents of files to the users' browsers rather than linking to the files via the use of URLs. The following example shows how to open a file on a local drive using its physical path and then write the binary contents of the file to the browser:
<VBCODE>
Response.ContentType = "Application/pdf"
Response.WriteFile("C:\Test\Test.pdf")
Response.End()
</VBCODE>
The above code works fine, but if I put the file on a mapped drive (e.g. "G:\Test\Test.pdf"), I get an error which says "System.IO.DirectoryNotFoundException: Could not find a part of the path "G:\Test\Test.pdf".
If I use the full path to the file, which is on another server (e.g. "\\ServerName\cdrive\Test\Test.pdf"), I get the following error message: "System.IO.IOException: Logon failure: unknown user name or bad password"
I am able to access the file via Windows Explorer. I believe the problem may have something to do with authentication. Can anyone help me with this?
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|