Website Authentication

WebKill

Member
Joined
Apr 7, 2008
Messages
12
Programming Experience
Beginner
I'm trying to write a program that will get certain text from an intranet site, but there is a form for user name and password that I have to enter first. I found HttpWebRequest and HttpWebResponse and can use those, but how do I programatically log into the site so I can get the data I want?
 
http.Credentials = New Net.NetworkCredential("username", "password")
http being your HttpWebRequest object
 
Last edited:
That's what I thought, but I'm still getting the user name and password screen, do I have this in the correct order?

VB.NET:
        Dim url As New Uri(webaddress)
        Dim request As HttpWebRequest = HttpWebRequest.Create(url)
        request.Method = WebRequestMethods.Http.Get
        request.Credentials = New Net.NetworkCredential(username, password)
        Dim response As HttpWebResponse = request.GetResponse()
        Dim reader As New StreamReader(response.GetResponseStream())
        Dim tmp As String = reader.ReadToEnd()
        response.Close()
 
I think it is a site domain issue, ask the provider if they can fix it (if it is yours) I had the same problem. The HttpWebRequest object just needs this property filled prior to get GetResponse call.
 
I misread the intranet part. I am dyslexic you know. The concepts should be the same, as they use the same technology. But I don't play around enough with this stuff.
 
Back
Top