I have to read a file "abc.txt" content from a remote server on intranet. I used WNetAddConnection2 to do that. Used this stackoverflow link and this link too. Now I made the connection as success. When I try to use the remote connection it still points to my C Drive. I want the connection to use the remote one I just made and get files from there.
var oNC = new System.Net.NetworkCredential()
                      {
                          Domain = "192.1.x.y",
                          UserName = "localhost\\myremoteadminusername",
                          Password = "myremotepassword"
                      };
        using (new NetworkConnection(@"\\" + "192.1.x.y", oNC))
        {
            String[] sfolderNames = Directory.GetDirectories(oNC.Domain + "\\Logs");
//Get Exception in above line bcoz it somehow points to my local C:\...\\bin\Debug\192.1.x.y\Logs
 //instead of remote 192.1.x.y\Logs
            foreach (String sFolderName in sfolderNames) 
            {
                string[] sarrZipFiles = Directory.GetFiles(sFolderName, "*.txt"); 
                foreach (String sFile in sarrZipFiles) 
                { 
                }
            } 
        }
What am I doing wrong? Let me know if you need anything else.