D
DOUGLAS HEESTAND
How do you add a textbox in code and add them to a particular form? I
am using WebRequest.Create (vb.net) to send a form request to
authorize.net for credit card processing. They require that one of
the fields is the account password. I have to send that as part of my
form but I don't want to have it visible to the user so a hidden form
field won't work. Is there a way to create the control in code, in
the proper form, before I send the form? Here is my code for sending
the form (it is attached to the onClick event for my submit button).
Thanks in advance!
---------------
Code
---------------
Dim objRequest As HttpWebRequest
Dim strPost As String
Dim strRequest As String
Dim strResult As String
Dim arrRequest As Byte()
Dim objUTF8Encoding As UTF8Encoding
Dim strmRequest As Stream
Dim objResponse As HttpWebResponse
Dim srResponse As StreamReader
'####INSERT CODE TO CREATE PASSWORD TEXTBOX HERE##########
strPost = Request.Form().ToString()
objRequest = CType(WebRequest.Create("https://secure.authorize.net/gateway/transact.dll"),
HttpWebRequest)
objRequest.Method = "POST"
objRequest.ContentType = "application/x-www-form-urlencoded"
strRequest = strPost
objUTF8Encoding = New UTF8Encoding
arrRequest = objUTF8Encoding.GetBytes(strRequest)
objRequest.ContentLength = strPost.Length
strmRequest = objRequest.GetRequestStream()
strmRequest.Write(arrRequest, 0, arrRequest.Length)
strmRequest.Close()
objResponse = objRequest.GetResponse()
srResponse = New StreamReader(objResponse.GetResponseStream(),
Encoding.ASCII)
strResult = srResponse.ReadToEnd()
am using WebRequest.Create (vb.net) to send a form request to
authorize.net for credit card processing. They require that one of
the fields is the account password. I have to send that as part of my
form but I don't want to have it visible to the user so a hidden form
field won't work. Is there a way to create the control in code, in
the proper form, before I send the form? Here is my code for sending
the form (it is attached to the onClick event for my submit button).
Thanks in advance!
---------------
Code
---------------
Dim objRequest As HttpWebRequest
Dim strPost As String
Dim strRequest As String
Dim strResult As String
Dim arrRequest As Byte()
Dim objUTF8Encoding As UTF8Encoding
Dim strmRequest As Stream
Dim objResponse As HttpWebResponse
Dim srResponse As StreamReader
'####INSERT CODE TO CREATE PASSWORD TEXTBOX HERE##########
strPost = Request.Form().ToString()
objRequest = CType(WebRequest.Create("https://secure.authorize.net/gateway/transact.dll"),
HttpWebRequest)
objRequest.Method = "POST"
objRequest.ContentType = "application/x-www-form-urlencoded"
strRequest = strPost
objUTF8Encoding = New UTF8Encoding
arrRequest = objUTF8Encoding.GetBytes(strRequest)
objRequest.ContentLength = strPost.Length
strmRequest = objRequest.GetRequestStream()
strmRequest.Write(arrRequest, 0, arrRequest.Length)
strmRequest.Close()
objResponse = objRequest.GetResponse()
srResponse = New StreamReader(objResponse.GetResponseStream(),
Encoding.ASCII)
strResult = srResponse.ReadToEnd()