串接API時一直出現錯誤
基礎連接已關閉: 傳送時發生未預期的錯誤。
上網查找資料後應該是SSL的問題,總之就是串接方已經不接受TLS1.0的協定,所以要強制讓我方以TLS1.1或1.2
需.NET4.0以上,記得先Imports System.Net才能用參數
之後再整個Request前先加上
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
就可以解決了,未來會不會需要更新成更高或其他的協議就未知啦
串接API時一直出現錯誤
基礎連接已關閉: 傳送時發生未預期的錯誤。
上網查找資料後應該是SSL的問題,總之就是串接方已經不接受TLS1.0的協定,所以要強制讓我方以TLS1.1或1.2
需.NET4.0以上,記得先Imports System.Net才能用參數
之後再整個Request前先加上
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
就可以解決了,未來會不會需要更新成更高或其他的協議就未知啦
Public Function TestRotate(sImageFilePath As String) As Boolean
Dim rft As RotateFlipType = RotateFlipType.RotateNoneFlipNone
Dim img As Bitmap = Image.FromFile(sImageFilePath)
Dim properties As PropertyItem() = img.PropertyItems
Dim bReturn As Boolean = False
For Each p As PropertyItem In properties
If p.Id = 274 Then
Dim orientation As Short = BitConverter.ToInt16(p.Value, 0)
Select Case orientation
Case 1
rft = RotateFlipType.RotateNoneFlipNone
Case 3
rft = RotateFlipType.Rotate180FlipNone
Case 6
rft = RotateFlipType.Rotate90FlipNone
Case 8
rft = RotateFlipType.Rotate270FlipNone
End Select
End If
Next
If rft <> RotateFlipType.RotateNoneFlipNone Then
img.RotateFlip(rft)
System.IO.File.Delete(sImageFilePath)
img.Save(sImageFilePath, System.Drawing.Imaging.ImageFormat.Jpeg)
bReturn = True
End If
Return bReturn
End Function