title: SslStream, disable session caching
body: <p>The <a href="https://msdn.microsoft.com/en-us/library/ms145056%28v=vs.110%29.aspx" rel="noreferrer">MSDN documentation</a> says</p>
  
  <blockquote>
    <p>The Framework caches SSL sessions as they are created and attempts to reuse a cached session for a new request, if possible. When attempting to reuse an SSL session, the Framework uses the first element of <a href="https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.clientcertificates%28v=vs.110%29.aspx" rel="noreferrer">ClientCertificates</a> (if there is one), or tries to reuse an anonymous sessions if <a href="https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.clientcertificates%28v=vs.110%29.aspx" rel="noreferrer">ClientCertificates</a> is empty.</p>
  </blockquote>
  
  <p>How can I disable this caching?</p>
  
  <p>At the moment I am experiencing a problem with a reconnect to a server (i.e., the first connection works good, but at attempt to reconnect the servers breaks the session). Restarting the application helps (but of course only for the first connection attempt). I assume the problem root is caching.</p>
  
  <p>I've checked the packets with a sniffer, the difference is at just single place only at Client Hello messages:</p>
  
  <p>First connection to the server (successful):</p>
  
  <p><img src="https://i.stack.imgur.com/EKBK0.png" alt="screenshot"></p>
  
  <p>Second connection attempt (no program restart, failed):</p>
  
  <p><img src="https://i.stack.imgur.com/Ld2jq.png" alt="screenshot"></p>
  
  <p>The difference seems to be just the session identifier.</p>
  
  <p>P.S. I'd like to avoid using 3rd-party SSL clients. Is there a reasonable solution?</p>
  
  <p><sub>This is a translation of <a href="https://ru.stackoverflow.com/q/420890/10105">this question</a> from ru.stackoverflow</sub></p>