sdlangers Posted March 3, 2003 Posted March 3, 2003 Hi, Im trying to set the username and password for a URI using the URIBuilder class. Im using the following code (except with real values for site, user, pword) : Dim i As New UriBuilder() i.Scheme = "http" i.Host = "www.site.com" i.UserName = "user" i.Password = "pword" Dim myRequest As WebRequest = WebRequest.Create(i.Uri) Dim myResponse As WebResponse = myRequest.GetResponse() However, an unathorized error occurs at the myResponse line. When i debug, it appears that the username and password is not set. can anyone help? thanks, danny. Quote
dgburton Posted June 6, 2003 Posted June 6, 2003 exact same problem! I'm having exactly the same problem!! - can anyone help? thx dan Quote
*Gurus* Derek Stone Posted June 6, 2003 *Gurus* Posted June 6, 2003 Dim oWebRequest As WebRequest = WebRequest.Create("http://www.google.com/") Dim oNetworkCredential As NetworkCredential = New NetworkCredential("user", "password") oWebRequest.PreAuthenticate = True oWebRequest.Credentials = oNetworkCredential Dim oWebResponse As WebResponse = oWebRequest.GetResponse() Quote Posting Guidelines
sdlangers Posted June 6, 2003 Author Posted June 6, 2003 Hi all, Derek, that looks like a nice workaround. BTW.. i had posted the original problem way back on a microsoft board and they got back saying that it was a bug and that they'd put in a request to fix it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.