CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2007
    Posts
    18

    Script to Enable HTTPS in IIS 5.1

    Hi Folks,
    I have installed a self signed certificate in IIS on my XP machine.
    I can manually enable the certificate by clicking Require Secure Channel (SSL) in IIS.
    But I want to be able to automate this switching on and off using code.
    A lot of websites say the way to do this is using this vbscript:

    ' This code enables 128-bit SSL on a web site.
    '
    ' ------ SCRIPT CONFIGURATION ------

    strComputer = "localhost"
    strSiteID = "1"

    ' Taken from AccessSSLFlags
    ' 8 = AccessSSL
    ' 256 = AccessSSL128
    intFlag = 264

    ' ------ END CONFIGURATION ---------

    set objWebSite = GetObject("IIS://" & strComputer & "/W3SVC/" & strSiteID)
    objWebSite.AccessSSLFlags = intFlag
    'objWebSite.AccessSSLFlags = True
    'objWebSite.AccessSSL = 8
    'objWebSite.AccessSSL128 = 256
    objWebSite.SetInfo

    It runs without exception but does not enable the Require Secure Channel (SSL) button in IIS.
    Is there any way of automating this setting in IIS? Or getting the above code to work?

  2. #2
    Join Date
    Sep 2007
    Posts
    18

    Re: Script to Enable HTTPS in IIS 5.1

    Bad time of the year for server side scripting code gurus?.

    Anyway I found the answer myself for future reference.

    This will set the check box.

    set vd = getObject("IIS://localhost/W3SVC/1/Root")
    vd.accessSSL = true
    vd.setInfo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured