原来asp的程序现在要用.net重写,这段代码内容是 当 点击验证按钮,然后把一些信用卡信息发过去验证,然后并从返回的值里判断是否通过验证...
不过Server.CreateObject("MSXML2.ServerXMLHTTP")啥的我不太明白,不知道在.net里应该怎么写这里呢?还是应该写在js里?我查了一下这个貌似跟现在的ajax有点关系?本来我想把这些写在按钮后台的触发事件里的,可是网上查了一下,这些貌似都是写在js里的....
我知道菜鸟不是借口,不过确实不懂不知该从哪下手,经理就这么扔给我让我自己想办法.... (┬_┬)想请教一下各位大虾:
1. 这部分验证是写在哪里比较好?前台js还是后台?
2. 用c#/js大致该怎么改写呢?
或者指点一下我该查哪方面的资料.... 现在真的有点迷茫....
严重感谢!!!
--------------------------------------------------------------------------------
strRequest = "type=auth" strRequest = strRequest & "&username=" & strPAUserName strRequest = strRequest & "&password=" & strPAPassword strRequest = strRequest & "&ccnumber=" & strPACreditCardNumber ....... set xmlHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP") xmlHTTP.Open "POST", strPAURL, False xmlHTTP.setRequestHeader "Content-Type","application/x-www-form-urlencoded" xmlHTTP.send strRequest strResponse = xmlHTTP.responseText set xmlHTTP = nothing aryPair = Split(strResponse, "&") set hstResponse = Server.CreateObject("Scripting.Dictionary") for each strPair in aryPair arySplitPair = Split(strPair, "=") hstResponse.Add arySplitPair(0), arySplitPair(1) next strResponseCode = hstResponse.Item("response_code") if hstResponse.Item("response") = "1" then strMessage = "SUCCESS: The credit card has been authorized. elseif hstResponse.Item("response") = "2" then strMessage = "DECLINED (" & strResponseCode & "): The credit card has declined. end if if hstResponse.Item("response") = "1" then strTransactionID = hstResponse.Item("transactionid") strPreAuthStatus = hstResponse.Item("response") else strPreAuthStatus = "0" end if set hstResponse = nothing
1 回答
- 1 回答
- 0 关注
- 423 浏览
添加回答
举报
0/150
提交
取消