วันพุธที่ 5 มิถุนายน พ.ศ. 2562

How To Migrate asp.net(under .net 4.5 ) website to TLS 1.2?


เมื่อมีการปิด TLS1.0
Error : The request was aborted: Could not create SSL/TLS secure channel.
ที่มา : https://github.com/navossoc/KeePass-Yet-Another-Favicon-Downloader/issues/23
สาเหตุ : อ่านเองนะ https://www.swoo.co.uk/blog/post/40135/how-to-migrate-a-net-website-to-tls-12

วิธีการแก้ไข ที่ง่ายได้ผล
Old Code : เดิมมีให้เลือกแค่นี้(VB.net)

// Only available from .Net 4.5+
 
// System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;

New Code : ตามนี้คับ
************************************************************
Dim _Tls12 As System.Security.Authentication.SslProtocols = CType(&HC00, System.Security.Authentication.SslProtocols)

Dim Tls12 As SecurityProtocolType = CType(_Tls12, SecurityProtocolType)
ServicePointManager.SecurityProtocol = Tls12
************************************************************

วิธีนี้ไม่ต้อง update .net Framework ได้ผลสำหรับผมนะ

ไม่มีความคิดเห็น: