0

In short I want to do something like this:

var request = (HttpWebRequest)WebRequest.Create(url);
request.Host = "example.com";
request.ServerName = ""; // <---- How?
request.BeginGetResponse(callback, state);

I know the SNI extension is a part of TLS protocol, but I am not sure how to control it in C#.

I have seen a comment said that .Net 4.5 doesn't support SNI, but even I use .Net 4.0, the SNI is still sent.

shingo
  • 18,436
  • 5
  • 23
  • 42
  • The problem this comment is probably referencing (can't check, because link is broken) is not a problem of .net but of the underlying OS. https://stackoverflow.com/a/26173919/3776927 – derpirscher Jan 16 '21 at 09:53
  • The server name is part of the URL and shouldn't be changed. TLS is performed before the HTTP request when you use a HTTPS in the URL. If you are failing the TLS it has nothing directly to do with the request since it is done before the request is sent. What error are you getting? – jdweng Jan 16 '21 at 11:47
  • @jdweng No error, I just want to change it to something else that is different with the host name. – shingo Jan 16 '21 at 12:17
  • @derpirscher So does that mean .net using Schannel too? – shingo Jan 16 '21 at 12:20
  • So youo want to look like a hacker. Because hackers try to disguise their websites to look like the real thing. – jdweng Jan 16 '21 at 15:03

0 Answers0