Access to the path is denied

Dec 1, 2010 at 6:41 PM


At the moment I'm using this method to create the VPN profile

Dim entry As RasEntry = RasEntry.CreateVpnEntry(EntryName, ServerIP, RasVpnStrategy.L2tpOnly, RasDevice.GetDeviceByName("(L2TP)", RasDeviceType.Vpn))
entry.Options.UsePreSharedKey = True
entry.UpdateCredentials(RasPreSharedKey.Client, SharedKey)

But when I try to run it I get a message saying

Access to the path is denied

C:\ProgramData\Microsoft\Network\Connections\Pbk is denied

I tried to run it as Admin but still doesnt help

Any help would be great.

Many Thanks

Dec 1, 2010 at 7:42 PM

Problem Solved by creating a custom phonebook :)


Dec 2, 2010 at 4:47 AM
Edited Dec 2, 2010 at 4:51 AM

That may be a number of things, does the folder already exist on the machine? Also, try checking the folder level security to ensure the folder can be accessed. If it doesn't exist, there may be a bug when opening a phonebook in folders that aren't already existing.

If you can get me the stack trace, exception message, and the exception type along with what operating system, and DotRas build version you're using that would be a big help to diagnosing the problem.

Edit: I just did a quick check, and the RasPhoneBook class can handle creating folders that don't already exist. There's an integration test to ensure this functionality isn't removed.

Dec 2, 2010 at 5:29 PM

Hi Jeff,

Your correct yes RasPhoneBook can handle creating folders if they don't exist.

The problem I had is my program was running on the normal user account it wasn't requesting for admin rights

What I did was change the application manifest to  <requestedExecutionLevel level="HighestAvailable" uiAccess="false" />

Then test it and worked great :)

Many Thanks for the help

Dec 2, 2010 at 10:52 PM

Ah, good to hear. I figured it was a security issue.

Apr 8, 2014 at 6:15 AM
Edited Apr 8, 2014 at 6:23 AM
  <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    <!-- UAC Manifest Options
        If you want to change the Windows User Account Control level replace the 
        requestedExecutionLevel node with one of the following.

    <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
    <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
    <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />
     you want to utilize File and Registry Virtualization for backward 
        compatibility then delete the requestedExecutionLevel node.

    <requestedExecutionLevel  level="asInvoker" uiAccess="false" />


tell me how to create pppoe dialer in windows 7, and 8 ?
sorry for english :D
its not working :(
Apr 10, 2014 at 1:46 AM
The all users profile phonebook is secured by Windows, you need administrative rights to access it, or force the application to require elevated rights. You can either do that, or use a phonebook that isn't stored in that location, they're just files on the machine after all.