2017-02-27 8 views
6

PayPalが応答を更新したため、.NET 3.5フレームワーク上にある既存のアプリケーションでセキュリティプロトコルTLSをv1.2に更新する必要があります。 これを既存のコードで更新するために必要な変更は、アプリケーションをより新しいフレームワークに更新することができません。セキュリティプロトコルを実装する方法.NET 3.5フレームワークのTLS 1.2

答えて

2

NET 3.5.1を使用している場合は、ロールアップの修正プログラムを適用し、レジストリの編集を適用して.NETにシステムのデフォルトを使用させることができます。 More details here

TLS 1.2 & 1.1のサポートには.NET 4.5を使用する必要があり、Windows Server 2008 R2では最低限必要です。

+0

あなたのリンクを

Imports System.Security.Authentication Imports System.Net 

は私のコード(C#の)にこれを追加しますは壊れてます。 – Cullub

5

私はVS 2008 with .net 3.5.30729.4926を使用しています。私がしなければならなかったすべてはだった:

輸入を追加します。

public const SslProtocols _Tls12 = (SslProtocols)0x00000C00; 
public const SecurityProtocolType Tls12 = (SecurityProtocolType)_Tls12; 
ServicePointManager.SecurityProtocol = Tls12 

VB.netバージョン:

Const _Tls12 As SslProtocols = DirectCast(&HC00, SslProtocols) 
Const Tls12 As SecurityProtocolType = DirectCast(_Tls12, SecurityProtocolType) 
ServicePointManager.SecurityProtocol = Tls12 

Dim wbrq As HttpWebRequest 
Dim wbrs As HttpWebResponse 
Dim sw As StreamWriter 
Dim sr As StreamReader 
Dim strResult As String 

'Create a new HttpWebRequest object. 
wbrq = WebRequest.Create(strURL) 
wbrq.Method = "POST" 
wbrq.ContentLength = DataString.Length 
wbrq.ContentType = "application/x-www-form-urlencoded" 

'upload data 
sw = New StreamWriter(wbrq.GetRequestStream) 
sw.Write(DataString) 
sw.Close() 

'get response 
wbrs = wbrq.GetResponse 
sr = New StreamReader(wbrs.GetResponseStream) 
strResult = sr.ReadToEnd.Trim 
sr.Close() 
+1

@Club Thanks。私はMSが古いバージョンの.netで定数を改造するかもしれないと思う。 –

+0

これは現時点での他の回答よりも優れています - 壊れたリンクに依存しません;-) – Cullub

+0

コードはどこに配置されましたか?クラスで?またはglobal.asax?等? – Anna

関連する問題