Solved

How to open/READ file from UNC path Shared Folder...

Posted on 2016-11-02
2
56 Views
Last Modified: 2016-11-03
How can i read file from FileShare. When i change filepath to local machine it works perfect, but when i change it to UNS path to SharedFolder, it wont work. And it throws an error System.IO.Exception

 
 try
            {
                var filePath = @"\\192.168.150.11\Tine Integrasjon\Riversand\Riversand.xml";
                var test = File.OpenRead(filePath);
                FileInfo file = new FileInfo(filePath);
                FileStream fs = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);

                if (!file.Exists)
                {
                    Run(sp, filePath);
                }
                else
                {
                    logger.WriteLine("Det finnes ingen fil å lese fra, sjekk mappen 'Riversand'", DateTime.Now.ToString());
                }
            }
            catch (Exception e)
            {
                logger.WriteLine("Failed to run application.", e.Message + Environment.NewLine + e.StackTrace);
            }

Open in new window


iam getting Exception:  System.IO.IOException " The user name or password is incorrect".

Visual studio is running as Administrator, an user have read /Write permission on SharedFolder.
Iam running my development enviroment on Windows Server 2012 R2, and another VM in same domain with SharedFolder. And Firewall is diabled in all domain.!

If i just paste UNC Path (\\192.168.150.11\Tine Integrasjon\Riversand\Riversand.xml) in FIleExplorer, it opens the file, without any issue on authenticating. But when iam running my Console Application and i try to read the file i get an error : The username or password is inncorrect...
0
Comment
Question by:Adnan
2 Comments
 
LVL 33

Accepted Solution

by:
ste5an earned 500 total points
ID: 41871414
Don't run VS as administrator..
0
 

Author Closing Comment

by:Adnan
ID: 41871732
resolved
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now