R
Ratnesh Raval
Hi there,
I am trying to post data to a 3rd party page from my ASP.net page.
Here is the snippet that I use (found in most of the examples when googled)
Dim dt As String = ""
dt &= "var1=abc"
Dim rqst As Net.HttpWebRequest = Net.HttpWebRequest.Create(destURL)
rqst.AllowAutoRedirect = True
rqst.Method = Net.WebRequestMethods.Http.Post
rqst.ContentLength = dt.Length
rqst.ContentType = "application/x-www-form-urlencoded"
Dim wr As New IO.StreamWriter(rqst.GetRequestStream)
wr.Write(dt)
wr.Close()
Dim oResp As Net.HttpWebResponse = rqst.GetResponse()
'Response.Redirect(oResp.ResponseUri.ToString)
Dim reader As New IO.StreamReader(oResp.GetResponseStream())
Dim tmp As String = reader.ReadToEnd()
oResp.Close()
Response.Write(tmp)
When it posts to other page, it gets the response and displays in my current
page.
The problem: the page, where I post, is supposed to redirect to different
page(s). but this code only gets the response and displays.
Is there any way to just to go the page while posting. That way all the next
steps are taken care by other page?
Thanks,
Nesh
I am trying to post data to a 3rd party page from my ASP.net page.
Here is the snippet that I use (found in most of the examples when googled)
Dim dt As String = ""
dt &= "var1=abc"
Dim rqst As Net.HttpWebRequest = Net.HttpWebRequest.Create(destURL)
rqst.AllowAutoRedirect = True
rqst.Method = Net.WebRequestMethods.Http.Post
rqst.ContentLength = dt.Length
rqst.ContentType = "application/x-www-form-urlencoded"
Dim wr As New IO.StreamWriter(rqst.GetRequestStream)
wr.Write(dt)
wr.Close()
Dim oResp As Net.HttpWebResponse = rqst.GetResponse()
'Response.Redirect(oResp.ResponseUri.ToString)
Dim reader As New IO.StreamReader(oResp.GetResponseStream())
Dim tmp As String = reader.ReadToEnd()
oResp.Close()
Response.Write(tmp)
When it posts to other page, it gets the response and displays in my current
page.
The problem: the page, where I post, is supposed to redirect to different
page(s). but this code only gets the response and displays.
Is there any way to just to go the page while posting. That way all the next
steps are taken care by other page?
Thanks,
Nesh