467,908 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,908 developers. It's quick & easy.

Error only on remote server "System.IO.FileNotFoundException: Could not find file"

Hey everyone

When I try to open a file i get the Exception listed below. The weird thing is it works when I run the web app locally and when i use a remote server and open a file on my computer. When someone else uses the web app and tries to open a file using the remote server the error below happens.

any help?

**Code**
C# - filepath is a valid file name which is passed via the form.
System.IO.BinaryReader br = new System.IO.BinaryReader(System.IO.File.Open(filepat h, System.IO.FileMode.Open, System.IO.FileAccess.Read));
br.BaseStream.Position=0;

**Error***
Exception Details: System.IO.FileNotFoundException: Could not find file "C:\t.txt".

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FileNotFoundException: Could not find file "C:\t.txt".]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +181
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +45
System.IO.File.Open(String path, FileMode mode, FileAccess access) +36
Aug 17 '07 #1
  • viewed: 7408
Share:
2 Replies
Plater
Expert 4TB
And "C:\t.txt" exists on the remote server? And with correct access permissions?
Aug 17 '07 #2
This happens due to permissions, you can try to temporary grant access to "everyone" on your path, that why you will be sure that the problem is caused due to permissions.
Nov 10 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Beryl Small | last post: by
2 posts views Thread by IkBenHet | last post: by
21 posts views Thread by Neel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.