HttpWebRequest through proxy, gateway timeout

E

Erik Fjelldal

Hello everybody

I am making a function sending SMS, to send SMS we subscribe for a service
from the norwegian telephone company Netcom
To send these messages we send a HttpWebRequest over internet.

The function work well when I am sending from my home without proxy, but
when I take the computer inside the company I get problem with the proxy,
the error message is
"The remote server returned an error: (504) Gateway Timeout."

Have anybody else out there solved a problem like this before, I would be
very happy if you could share your experience with me.

Erik Fjelldal

My code:
Dim SMSURL As String = http://firebolt.netcom.no:8080/sms/send
Dim Request As HttpWebRequest
Dim Response As HttpWebResponse
Dim RequestString As String

RequestString = SMSURL & "?"
RequestString &= "number=" & "12345678"
RequestString &= "&"
RequestString &= "message=Hello, this is a test."
Request = WebRequest.Create(RequestString)
Request.KeepAlive = True
Request.MaximumResponseHeadersLength = 99999

Dim MyProxy As New WebProxy
MyProxy = GlobalProxySelection.Select
MyProxy.UseDefaultCredentials = True
Request.Proxy = MyProxy

Dim myCache As New CredentialCache
myCache.Add(New Uri(SMSURL), "Basic", New NetworkCredential("myUserName",
"myPassWord"))
Request.Credentials = myCache

Response = Request.GetResponse
Dim ResponseStream As IO.Stream
ResponseStream = Response.GetResponseStream
Dim ReadStream As New IO.StreamReader(ResponseStream, False)
Dim ResponseString = ReadStream.ReadToEnd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top