古いClassicASPサイトのロジックをasp.netプロジェクトに変換する必要があります。データの投稿を担当する関数の理解に問題があります。
クラシックASPの関数は次のとおりです。
<%Function PostHTTP(strURL, strBody, strErrTemplate)
ON ERROR RESUME NEXT
Dim objHTTP, strResult
Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
If Err.Number <> 0 Then
strResult = Replace(strErrTemplate, "%1", Err.Number)
strResult = Replace(strResult, "%2", Err.Description)
strResult = Replace(strResult, "%3", "Init::" & Err.Source)
Set objHTTP = Nothing
PostHTTP = strstrResult
Exit Function
End If
With objHTTP
.Open "POST", strURL, False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setTimeouts 30000, 30000, 60000, 240000
.send strBody
If Err.Number <> 0 Then
strResult = Replace(strErrTemplate, "%1", Err.Number)
strResult = Replace(strResult, "%2", Err.Description)
strResult = Replace(strResult, "%3", "Post::" & Err.Source)
Else
strResult = .responseText
End If
End With
' Response.Write "strResult: " & strResult
'Response.End
If Err.Number > 0 Then
strResult = Replace(strErrTemplate, "%1", Err.Number)
strResult = Replace(strResult, "%2", Err.Description)
strResult = Replace(strResult, "%3", Err.Source)
ElseIf Len(strResult) = 0 Then
strResult = Replace(strErrTemplate, "%1", 2000)
strResult = Replace(strResult, "%2", "No response received from remote server.")
strResult = Replace(strResult, "%3", "PostHTTP")
End If
PostHTTP = strResult
Set objHTTP = Nothing
End Function
これはasp.netではどのように見えますか?
ps:私は自分の投稿機能を試しましたが、私のものが機能しないため、明らかに何かを逃しました。