.NETGURU
Does anybody know how to write this code in C#
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcs' list.


Oliver S.
Does anybody know how to write this code in C#

<%
Response.Buffer = True
Dim objXMLHTTP, xml

'Create & initialize the XMLHTTP object
Set xml = Server.CreateObject("Microsoft.XMLHTTP")

sRemoteURL = "https://www.eProcessingNetwork.Com/cgi-bin/tdbe/transact.pl"

'Open the connection to the remote server
xml.Open "POST", sRemoteURL, False

'Send the request to the eProcessingNetwork Transparent Database Engine
xml.Send "ePNAccount=05971&CardNo=05971&ExpMonth=10&ExpYear=01" & _
"&Total=12.95&Address=123&Zip=12345&HTML=No"

'store the response
sResponse = xml.responseText

Response.Write "<html><body>"

'parse the response string and handle appropriately
sApproval = mid(sResponse, 2, 1)

if sApproval = "Y" then
Response.Write "Your transaction has been approved with the " & _
"following response: <b>" & mid(sResponse, 3, 16) & "</b><br>"

iPosition = instr(sResponse, ",")
if iPosition > 0 then
iAvsLength = len(sResponse) - iPosition - 2
Response.Write "AVS Response: <b>" & _
mid(sResponse, iPosition + 2, iAvsLength) & "</b>"
end if
elseif sApproval = "N" then
Response.Write "Your transaction has been declined with the " & _
"following response: <b>" & mid(sResponse, 3, 16) & "</b><br>"
else
Response.Write "The processor was unable to handle your " & _
"transaction, having returned the following response: <b>" & _
sResponse & "</b><br>"
end if

Response.Write "</body></html>"

Set xml = Nothing
%>

Reply to this message...
 
    
Mark Bruce
Use the WebRequest,WebResponse, HttpWebRequest, and HttpWebResponse classes. There are examples in Help.
HTH
Mark
"Oliver S." wrote:Does anybody know how to write this code in C#

Response.Buffer = True
Dim objXMLHTTP, xml

'Create & initialize the XMLHTTP object
Set xml = Server.CreateObject("Microsoft.XMLHTTP")

sRemoteURL = "https://www.eProcessingNetwork.Com/cgi-bin/tdbe/transact.pl"

'Open the connection to the remote server
xml.Open "POST", sRemoteURL, False

'Send the request to the eProcessingNetwork Transparent Database Engine
xml.Send "ePNAccount=05971&CardNo=05971&ExpMonth=10&ExpYear=01" & _
"&Total=12.95&Address=123&Zip=12345&HTML=No"

'store the response
sResponse = xml.responseText

Response.Write ""

'parse the response string and handle appropriately
sApproval = mid(sResponse, 2, 1)

if sApproval = "Y" then
Response.Write "Your transaction has been approved with the " & _
"following response: " & mid(sResponse, 3, 16) & "
"

iPosition = instr(sResponse, ",")
if iPosition > 0 then
iAvsLength = len(sResponse) - iPosition - 2
Response.Write "AVS Response: " & _
mid(sResponse, iPosition + 2, iAvsLength) & ""
end if
elseif sApproval = "N" then
Response.Write "Your transaction has been declined with the " & _
"following response: " & mid(sResponse, 3, 16) & "
"
else
Response.Write "The processor was unable to handle your " & _
"transaction, having returned the following response: " & _
sResponse & "
"
end if

Response.Write ""

Set xml = Nothing
%>

| [aspngcs] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngcs.asp = JOIN/QUIT

---------------------------------
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs
Reply to this message...
 
    
Niraj Ranka
(Type your message here)

--------------------------------
From: Niraj Ranka

Add the refrence of msxml.dll located at "C:\windows\winnt\system32" (may be different in no win 2000) through the reference option and then to com tab option, in you project and take the help of below given code..,
Hope it may help

Dim tempXML As MSXML.XMLHTTPRequest
Dim strURL As String
Dim tempstr As String
tempXML = New MSXML.XMLHTTPRequest
strURL = "http://webmail.ameriteck.net";
tempXML.open("GET", strURL, False, "", "")
tempXML.send()
Response.Write("Here's the html we now have in our xml object")
Response.Write("<BR><BR><BR>")
Response.Write("<xmp>")
tempstr = tempXML.responseText
Response.Write(tempstr)
Response.Write("</xmp>")
Response.Write("<BR><BR><BR>")
Response.Write(" Now here's how the page looks:<BR><BR>")
Response.Write(tempstr)
tempXML = Nothing
Reply to this message...
 
    
Niraj Ranka
(Type your message here)

--------------------------------
From: Niraj Ranka

Add the refrence of msxml.dll located at "C:\windows\winnt\system32" (may be different in no win 2000) through the reference option and then to com tab option, in you project and take the help of below given code..,
Hope it may help

Dim tempXML As MSXML.XMLHTTPRequest
Dim strURL As String
Dim tempstr As String
tempXML = New MSXML.XMLHTTPRequest
strURL = "http://webmail.ameriteck.net";
tempXML.open("GET", strURL, False, "", "")
tempXML.send()
Response.Write("Here's the html we now have in our xml object")
Response.Write("<BR><BR><BR>")
Response.Write("<xmp>")
tempstr = tempXML.responseText
Response.Write(tempstr)
Response.Write("</xmp>")
Response.Write("<BR><BR><BR>")
Response.Write(" Now here's how the page looks:<BR><BR>")
Response.Write(tempstr)
tempXML = Nothing
Reply to this message...
 
 
System.Net.HttpWebRequest
System.Net.HttpWebResponse
System.Net.WebRequest
System.Net.WebResponse




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification