View Single Post
  #24 (permalink)  
Old January 4th, 2007, 06:19 AM
SQLMaster SQLMaster is offline
Registered User
 
Join Date: Jan 2007
Location: Ingelheim am Rhein, Rheinland-Pfalz, Germany.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I'm using this in a class and it returns the response string:


    Protected Const ORDERENVIRONMENT As String = "http://www.anyserver.com/order.aspx?ID="

    Protected Function ProcessOrder(ByVal theID as Long, ByVal p1 as String, ByVal p2 as String) As String
        Dim reqStrg As String = String.Empty
        Dim req As System.Net.HttpWebRequest
        Dim res As System.Net.HttpWebResponse
        Dim sr As System.IO.StreamReader
        Dim s As System.IO.Stream
        Dim b As Byte()
        Dim myResult As String = String.Empty
        req = System.Net.WebRequest.Create(ORDERENVIRONMENT + theID.ToString())
        reqStrg = "param1=" + Server.UrlEncode(p1) + "&"
        reqStrg += "param2=" + Server.UrlEncode(p2)
        b = System.Text.Encoding.ASCII.GetBytes(reqStrg)
        req.Method = "post"
        req.ContentType = "application/x-www-form-urlencoded"
        req.KeepAlive = False
        req.Timeout = 30000
        req.ProtocolVersion = HttpVersion.Version10
        req.ContentType = "application/x-www-form-urlencoded"
        req.Proxy = System.Net.WebProxy.GetDefaultProxy()
        req.AllowAutoRedirect = True
        req.MaximumAutomaticRedirections = 10
        req.UserAgent = "Mozilla/3.0 (compatible; My Browser/1.0)"
        req.ContentLength = b.Length
        s = req.GetRequestStream()
        s.Write(b, 0, b.Length)
        res = req.GetResponse()
        sr = New System.IO.StreamReader(res.GetResponseStream())
        myResult = sr.ReadToEnd
        sr.Close()
        res.Close()
        Return myResult
    End Function

Hope this is what you're looking for.

The internet gives and the internet takes!

Yours,
Raisor
Reply With Quote