V
Vishal
Hello,
I already asked this question in the ASP.NET forums,
but no help came. So I am hoping that somebody can help me
out. This is really very URGENT me.
For my e-commerce application, I need to send data from my
server via the post method to the payment server. The
payment server does not run asp.net. I dont know what they
run. The payment server then returns to my server with the
result in the qs.
Here is the code, which I use to send the data to the
server:
Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
Dim data() As String =
{"name=vishal", "Joined=15May2004", "TotalPosts=112"}
PagePipe("http://www.site.com/file.htm", Data)
End Sub
Private Sub PagePipe(ByVal URL As String, ByVal data
As String())
Dim HWR As System.Net.HttpWebRequest
Dim sr As System.IO.StreamReader
Dim s, sData As String
Dim enc As System.Text.ASCIIEncoding
Dim b() As Byte
' set up request
HWR = System.Net.HttpWebRequest.Create(URL)
HWR.Method = "POST"
For Each s In data
sData += s + "&"
Next
sData = sData.Trim("&")
enc = New System.Text.ASCIIEncoding()
b = enc.GetBytes(sData)
HWR.ContentType = "application/x-www-form-
urlencoded"
HWR.ContentLength = b.Length
HWR.GetRequestStream().Write(b, 0, b.Length)
' get response
Response.Clear()
Response.Buffer = False
Response.ContentType = HWR.ContentType
sr = New System.IO.StreamReader(HWR.GetResponse
().GetResponseStream)
Response.Write(sr.ReadToEnd)
Response.End()
End Sub
The user must login before he can make any purchase. Once
he has logged in, I store the userid in a session object.
However when I use the above code, then I am somehow
loosing the session variable value or it is not
recognized. Now the return page is a page, which always
check at the beginning if the user is logged in or not.
Unfortunaly now the user is redirected to the login.aspx
instead of the result.aspx. If I do a response.write for
the userid then it is empty. Can somebody see why this is
happens and how it can be avoided?
Thanks in advance
I already asked this question in the ASP.NET forums,
but no help came. So I am hoping that somebody can help me
out. This is really very URGENT me.
For my e-commerce application, I need to send data from my
server via the post method to the payment server. The
payment server does not run asp.net. I dont know what they
run. The payment server then returns to my server with the
result in the qs.
Here is the code, which I use to send the data to the
server:
Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
Dim data() As String =
{"name=vishal", "Joined=15May2004", "TotalPosts=112"}
PagePipe("http://www.site.com/file.htm", Data)
End Sub
Private Sub PagePipe(ByVal URL As String, ByVal data
As String())
Dim HWR As System.Net.HttpWebRequest
Dim sr As System.IO.StreamReader
Dim s, sData As String
Dim enc As System.Text.ASCIIEncoding
Dim b() As Byte
' set up request
HWR = System.Net.HttpWebRequest.Create(URL)
HWR.Method = "POST"
For Each s In data
sData += s + "&"
Next
sData = sData.Trim("&")
enc = New System.Text.ASCIIEncoding()
b = enc.GetBytes(sData)
HWR.ContentType = "application/x-www-form-
urlencoded"
HWR.ContentLength = b.Length
HWR.GetRequestStream().Write(b, 0, b.Length)
' get response
Response.Clear()
Response.Buffer = False
Response.ContentType = HWR.ContentType
sr = New System.IO.StreamReader(HWR.GetResponse
().GetResponseStream)
Response.Write(sr.ReadToEnd)
Response.End()
End Sub
The user must login before he can make any purchase. Once
he has logged in, I store the userid in a session object.
However when I use the above code, then I am somehow
loosing the session variable value or it is not
recognized. Now the return page is a page, which always
check at the beginning if the user is logged in or not.
Unfortunaly now the user is redirected to the login.aspx
instead of the result.aspx. If I do a response.write for
the userid then it is empty. Can somebody see why this is
happens and how it can be avoided?
Thanks in advance