0

I am trying to specify sstp connection in DotRas - I have found a sample how to do it -

RasDevice device = RasDevice.GetDeviceByName("(SSTP)", RasDeviceType.Vpn, false);
            if (device == null) throw new Exception("Cannot get RasDevice");
            RasEntry entry = RasEntry.CreateVpnEntry(connectionName, serverAddress, RasVpnStrategy.SstpOnly, device);

But in my RasVpnStrategy there are only Default, L2tpFirst, L2tpOnly, PptpFirst, PptpOnly fields availble.

I have found that :

/// <summary>
    /// Defines the VPN strategies.
    /// </summary>
    public enum RasVpnStrategy
    {
        /// <summary>
        /// Dials PPTP first. If PPTP fails, L2TP is attempted.
        /// </summary>
        Default = 0,

        /// <summary>
        /// Dial PPTP only.
        /// </summary>
        PptpOnly = 1,

        /// <summary>
        /// Always dial PPTP first.
        /// </summary>
        PptpFirst = 2,

        /// <summary>
        /// Dial L2TP only.
        /// </summary>
        L2tpOnly = 3,

        /// <summary>
        /// Always dial L2TP first.
        /// </summary>
        L2tpFirst = 4,
#if (WIN2K8)
        /// <summary>
        /// Dial SSTP only.
        /// </summary>
        SstpOnly = 5,

        /// <summary>
        /// Always dial SSTP first.
        /// </summary>
        SstpFirst = 6
#endif
    }

So, I could not even specify Sstp in my app? (Win7)

curiousity
  • 4,703
  • 8
  • 39
  • 59

3 Answers3

1

You need to reference at least the Win2k8 version of the DotRas.dll then you should have the RasVpnStrategy.SstpOnly and RasVpnStrategy.SstpFirst enum options.

Paul
  • 135
  • 7
0

Even in the W2K assemblies the RasVpnStrategy.SstpOnly and RasVpnStrategy.SstpFirst enum options are missing as it seems but the code below works for me.

var device = RasDevice.GetDevices().FirstOrDefault(d => d.Name.Contains("SSTP"));
RasEntry entry = RasEntry.CreateVpnEntry(entryName, ipAddress, (RasVpnStrategy)5, device);
Richard Houltz
  • 1,962
  • 1
  • 18
  • 24
-1

It is not possible in current DOTRas release - only PPTP/L2TP available.

curiousity
  • 4,703
  • 8
  • 39
  • 59
  • This “answer” is completely inaccurate, as it depends on which version of Windows you plan to target. Older versions on Windows don’t support it, so the OS targeted libraries can’t either. As the answer below states, you’d want to use the Win2k8 variant. – Jeff Winn Mar 15 '19 at 11:19