我試圖從巴克萊支付網關實現加密腳本,但它是在VB中,我們的網站的其餘部分是在C#中。巴克萊加密asp.net(VB到C#)
劇本是
Public Class Example
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
'The Following Creates the WebClient Object
Dim web As New System.Net.WebClient()
'The Header Content Type is then set
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
'PostData is then declared as data type Byte and populated with the post data
Dim PostData As Byte() = System.Text.Encoding.ASCII.GetBytes("clientid=[clientid]&password=[password]&oid=[orderid]&chargetype=PreAuth¤cycode=826&total=[total]")
'The Web object is then used to upload the postdata to the Encryption URL and the response is stored in the Response variable
Dim Response As Byte() = web.UploadData("https://secure2.epdq.co.uk/cgi-bin/CcxBarclaysEpdqEncTool.e", "POST", PostData)
'The response from the post is then converted from Type Byte to String and stored in the session variable
Session("Response") = (System.Text.Encoding.ASCII.GetString(Response))
End Sub
End Class
我怎麼能無論是在我的C#aspx頁面運行這個VB?或者我需要將其轉換爲使用c#?在我的aspx頁面中,我有第一行
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" CodeBehind="encryption.cs" %>
感謝您的任何幫助。
基本上是建立交流#asp.net頁面並在page_load方法中將'Dim X as Y'更改爲'YX'或'var X'幾乎可以讓你在那裏。 –