Hi, I have a program that will download files from a company website given a list of links. The site requires authentication, and I do have code that will set the authentication cookie in the request header. I get the authentication cookie from a Perl script we have. What I would love to do is have my vb .net program get the authentication cookie based on my username and password. The perl script goes to the following link:
The it reads the cookie out of the response. Here is the code I have, but my cookie count always comes back at zero. :(
Dim cookieJar As New Net.CookieContainer() Dim cookie As New Net.Cookie Dim req As Net.HttpWebRequest Dim resp As Net.HttpWebResponse Dim strUrlLogon As String = "http://site.domain.com/cgi?func=ll.login&NextURL=/&Username=foo&Password=bar" req = Net.HttpWebRequest.Create(strUrlLogon) resp = req.GetResponse() txtCookie.Text = resp.Cookies.Count.ToString resp.Close()
Now this is just to get a count of cookies returned. I always get zero! I have tried various things to pull the cookie out, but what good is that if there isn't one? I have verified the request link and username and password. The perl script works fine. Thanks all.