By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,816 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,816 IT Pros & Developers. It's quick & easy.

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

P: 2
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
Share this Question
Share on Google+
2 Replies


Plater
Expert 5K+
P: 7,872
And "C:\t.txt" exists on the remote server? And with correct access permissions?
Aug 17 '07 #2

P: n/a
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.