Proxy Authentication Error...
Hi all.
I have created a Windows Service that runs every 8 minutes to go out and get the current weather for several of our company's locations. To access the internet, we are required to provide a username and a password. This has to do with our proxy. After 8 hours of INITIALLY logging in, the authentication expires requiring authentication again.
My VB.NET 2005 application does not have this implemented. I would like to create a sub routine that gets called everytime the service goes out to the internet for the current weather. I don't know how to code this and my searches have come up with nothing.
Can someone help me with a code example as to how I would authenticate so my .NET app can access the internet without getting a 407 error. Proxy Authentication Required.
Thanks.
Greggory
Re: Proxy Authentication Error...
Just wanted to step in and let you know that I was able to authenticate through the proxy using the following method:
Code:
'LOG ON TO THE PROXY.
Try
Dim makeReq As HttpWebRequest
Dim giveCred As NetworkCredential
makeReq = WebRequest.Create("http:\\www.google.com")
giveCred = New NetworkCredential(proxyLoginId, proxyPassword)
makeReq.Proxy = New System.Net.WebProxy("111.111.111.1", 9119)
makeReq.Proxy.Credentials = giveCred
Catch ex As Exception
writeToLog(ex.Message.ToString())
End Try
Gregg Payne