I cannot work this one out!
Create a VS2010 windows application that just does a FileInfo("Y:/test.txt") and when debugging the FileInfo works fine.
Do exactly the same thing via VS2013 and it reports file not found.
So there is some kind of trust or impersonation issue, this is a windows application though and i'm running VS2013 as administrator.
It's driving me nuts - anyone got any ideas?
thanks Paul
When UAC is enabled in Windows and you are a member of the Administrators group, you actually end up with two logon sessions - one as a regular user and one as an administrator. Your mapped drives are only associated with your regular user logon session, so when you run a program as administrator it does not see the mapped drives.
This link provides more details and a work-around (that I haven't tried myself!) that involves changing the registry:
To work around this problem, configure the EnableLinkedConnections registry value. This value enables Windows Vista and Windows 7 to share network connections between the filtered access token and the full administrator access token for a member of the Administrators group. After you configure this registry value, LSA checks whether there is another access token that is associated with the current user session if a network resource is mapped to an access token. If LSA determines that there is a linked access token, it adds the network share to the linked location. To configure the EnableLinkedConnections registry value
Click Start, type regedit in the Start programs and files box, and then press ENTER.
Locate and then right-click the registry subkey HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.
Point to New, and then click DWORD Value.
Type EnableLinkedConnections, and then press ENTER.
Right-click EnableLinkedConnections, and then click Modify.
In the Value data box, type 1, and then click OK.
Exit Registry Editor, and then restart the computer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With