Reputation: 1742
In C# code, if I refer to a file by just the file name, it's not reading it from the local folder. Instead it refers to c:\windows\system32\inetsrv\
and throws a FileNotFoundException
. How do I read from the local folder?
Upvotes: 0
Views: 238
Reputation: 31260
You probably are referring to the files in the virtual directory. Use Server.MapPath
filePath = Server.MapPath("~/path/relative/to/site/root/filename")
Upvotes: 2