EasyHTTP - trying to work out GETting.

moktarino

New member
Joined
Feb 9, 2010
Messages
4
Programming Experience
Beginner
I'm a sysadmin trying to write a utility to automatically download and install the appropriate and current drivers from the Dell website.

I'm just getting started and at the moment I'm working on trying to figure out how to submit the correct URI to their site. I've identified the parameters, but I just can't seem to get them to take.

For instance, the generated URI takes me to the correct page if I use a browser or wget, but all the code seems to get is the "duhwhat" page.

Here's my code, I didn't include the EasyHTTP class as it's unmodified from the original. Can anybody save me a few gray hairs and tell me what's going wrong?

BTW, this is try #2, I noodled with manually doing the webrequest then found EasyHTTP, hoping it would be...easy.

Thanks for looking!


VB.NET:
Imports System
Imports System.IO
Imports System.Net
Imports System.Text

Public Class Form1
    Dim urlstring As String = "http://support.dell.com/support/downloads/driverslist.aspx"


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
 System.EventArgs) Handles Button1.Click
      
        'catid is the type of driver (3 is audio) and OS is the OS (not sure why
        'XP gets "WW1"). These will be determined by radio buttons at runtime. 
        'Only three of these are necessary to input into a browser: servicetag, 
        'os, and catid. 
        
        Dim catid As String = "3"
        Dim os As String = "WW1"
        Dim postData As String = "servicetag" + ChrW(61) + TextBox1.Text
        postData = postData + ChrW(38) + "os" + ChrW(61) + os
        postData = postData + ChrW(38) + "osl" + ChrW(61) + "en"
        postData = postData + ChrW(38) + "catid" + ChrW(61) + catid
        postData = postData + ChrW(38) + "c" + ChrW(61) + "us"
        'This changes for every device and doesn't seem to be necessary.
        ' postData = postData + ChrW(38) + "cs" + ChrW(61) + "us"
        postData = postData + ChrW(38) + "l" + ChrW(61) + "en"
        postData = postData + ChrW(38) + "s" + ChrW(61) + "pub"
        
        'The data returned by this is the "WTF was that?" page.
        RichTextBox1.Text = easyhttp.Send(urlstring, postData, _ 
easyhttp.HTTPMethod.HTTP_POST, "application/x-www-form-urlencoded")

        'This works fine
        System.Diagnostics.Process.Start(urlstring + "?" + postData)



    End Sub
End Class

edit: Upon closer examination with a protocol analyzer, it's actually GETting.
 
Last edited:
Here's some packet captures. This is wget successfully getting the right data:

VB.NET:
GET /support/downloads/driverslist.aspx?c=us&cs=2684&l=en&s=bsd&catid=3&os=WW1&osl=en&servicetag=dkqnzb1 HTTP/1.0
User-Agent: Wget/1.11.4
Accept: */*
Host: support.dell.com
Connection: Keep-Alive

I'm not including the response because it's huge.

Here's my code utterly failing:
VB.NET:
GET /support/downloads/driverslist.aspx?c=us&cs=2684&l=en&s=bsd&catid=3&os=WW1&osl=en&servicetag=dkqnzb1 HTTP/1.1
Host: support.dell.com

Here's Dell's response:
VB.NET:
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="%2fsupport%2fdownloads%2f500.htm%3faspxerrorpath%3d%2fsupport%2fdownloads%2fdriverslist.aspx">here</a>.</h2>
</body></html>
 
This gets same content as browser for that url:
VB.NET:
Dim url = "http://support.dell.com/support/downloads/driverslist.aspx?c=us&cs=2684&l=en&s=bsd&catid=3&os=WW1&osl=en&servicetag=dkqnzb1"
Dim web As New Net.WebClient
web.Headers(Net.HttpRequestHeader.UserAgent) = ".Net agent"
web.DownloadFile(url, "sample.htm")
Only the UserAgent was required to specify here.
 
Yes! It was the user agent! I actually figured out how to add that to the EasyHTTP class a few moments ago and got it working. I tried to update, but vbdotnetforums had some kind of error from which it has apparently recovered.
(PHP has encountered an Access Violation at 7C810A5B, if you're curious)

Thanks! Now on to regular expressions to extract the FTP download links!
 
If you cant extract the links out of the html, let me know. I could provide you a class (a dll) where you specify an xpath string. I've always used this class for information grabbing.
 
I got RegEx to find the name of the file, but Dell obscures their links with javascript. They do store their files in predictable locations, however, so I can reliably know that the audio files are going to be located in ftp.us.dell.com/audio.

What I'm trying to figure out at the moment is how to download the files through FTP. I haven't found too many decent tutorials on it, if you know of one please let me know.

Thanks!
 
What I'm trying to figure out at the moment is how to download the files through FTP. I haven't found too many decent tutorials on it, if you know of one please let me know.
My.Computer.Network.DownloadFile
 
Back
Top