Create RasEntry with options

Oct 9, 2010 at 10:02 PM

Hi there,

I would like to create a RasEntry with the following options disabled:

  • File and Printer Sharing
  • Client for Microsoft Networking
  • Remote Default Gateway

I tried this, found the remotedefaultgateway property in the Docs, but that doesn't work.

            DotRas.RasEntryOptions rasEntryOptions = new DotRas.RasEntryOptions()
                RemoteDefaultGateway = false

 Anyone has a nice way to do this?



Oct 11, 2010 at 1:35 AM


You will need to set the options directly on the entry whose options you wish to change. This is done through the entry.Options property that is made available, it too uses the RasEntryOptions class.

entry.Options.SecureFileAndPrint = true;
entry.Options.SecureClientForMSNet = true;
entry.Options.RemoteDefaultGateway = false;

That will clear the settings you requested, in order. You will however need to use the WINXP or later build type to have access to the first two properties mentioned above. I would advise against creating a new instance of the RasEntryOptions class unless you know exactly what you're doing with it, clearing some of the default options may have undesired consequences.

Hope that helps,

- Jeff

Oct 11, 2010 at 7:09 AM

Thanks Jeff,

This works great! 


Oct 11, 2010 at 1:31 PM

Glad I could help. I updated the documentation on all of the options to help map which options go to which checkboxes and flags in the connection properties. Hopefully that will help everyone find the options they wish to set.

Happy coding!