How to specify SSTP usage in DotRas?

1.1k Views Asked by At

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)

3

There are 3 best solutions below

1
On BEST ANSWER

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

0
On

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);
0
On

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.