none
C# + HttpWebRequest + https + inject server name extension RRS feed

  • Question

  • How to set server name extension for a Https request using HttpWebrequest class in C#? (Support for SNI)

    Thanks


    mak
    • Moved by Leo Liu - MSFT Thursday, July 14, 2011 2:17 AM Off-Topic (From:Visual C# General)
    Thursday, July 7, 2011 6:35 AM

All replies

  • A simple solution is here... http://weblogs.asp.net/wim/archive/2004/04/02/106281.aspx

    Thanks


    Anirban Bhattacharya (Lead Consultant - ESSPL)
    Thursday, July 7, 2011 3:39 PM
  • Hi shahmak,

    How is it going with Anirban's suggestion?
    We are looking forward to hearing from you.

    Have a nice day,
    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 12, 2011 6:07 AM
  • Thanks Anirban.. but the solution provided in the link doesnt work. I am trying to use SNI here. I am targeting a server that has many virtual hosts, each having its own certificate.

    I am trying to use HttpWebRequest class to do Https request. I am getting a handshake failure.

    I can make this work using Libcurl. The difference in 2 requests when analysed using Wireshark being the "server name" extension, which is missing in C# HttpWebrequest.

    Thanks 


    mak
    Tuesday, July 12, 2011 6:25 AM
  •  

    Hi mak,

       Check out here It shows how to set/install certificate and use HTTPS.


    Thanks
    If you find any answer helpful, then click "Vote As Helpful" and if it also solves your question then also click "Mark As Answer".
    Tuesday, July 12, 2011 7:26 AM
  • Thanks truptivd... Nice article.. but using this approach I always get ServerNameMismatch error. Is there a way to avoid this error by setting the server name as google chrome does in the TLS extensions.

     

     


    mak
    Tuesday, July 12, 2011 8:42 AM
  • So shahmak,

    You can post your thread in the .NET Framework Networking and Communication Forum for specialized support.
    I am moving your thread into the Off-Topic Forum shortly. Thanks for your understanding.

    Have a nice day,

    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, July 13, 2011 6:38 AM