RadhaKrishnaKiJaya
asked on
Access network file from c# program
Hello Experts,
I have file in a network shared folder. I can access it from file explorer(\\10.0.1.22\Users \mm\Test.t xt). But when I am trying to access it from the C# program it says file does not exists. Any suggestions?
FileInfo myFile = new FileInfo(@"\\10.0.1.22\Use rs\mm\Test .txt");
bool exists = myFile.Exists;
Thanks in advance.
I have file in a network shared folder. I can access it from file explorer(\\10.0.1.22\Users
FileInfo myFile = new FileInfo(@"\\10.0.1.22\Use
bool exists = myFile.Exists;
Thanks in advance.
using the same account to run both file explorer and your c# app?
ASKER
Thank you for your reply! Actually I am using the same account for both.
Hello,
Change your FileInfo declaration to the following by inserting C$ or the hidden share drive letter for the drive the users folder is on:
FileInfo myFile = new FileInfo(@"\\10.0.1.22\C$\Users\mm\Test.txt");
Sean
Change your FileInfo declaration to the following by inserting C$ or the hidden share drive letter for the drive the users folder is on:
FileInfo myFile = new FileInfo(@"\\10.0.1.22\C$\Users\mm\Test.txt");
Sean
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.