News:

Wieners, Brats, Franks, we've got 'em all.

Main Menu

HTTP Stuff

Started by abc, August 01, 2008, 09:38:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

abc

hey uh, I'm trying to setup an automated login for a website and I've been packet logging the login I've been coming across some problems.

I see

Host: secure.somesite.com\r\n
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1\r\n
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n
Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n
Keep-Alive: 300\r\n
Connection: keep-alive\r\n
Referer: http://www.somesite.com
Content-Type: application/x-www-form-urlencoded\r\n
Content-Length: 682


My question is, when sending this information, do I have to send it in the exact order for it to work?

I'm programming in C# using the HttpWebRequest


Sidoh

These are HTTP headers, so order isn't important.

Use HttpWebRequest.Headers.Add(string name, string value) before you send the request.

abc

thanks for the clarification Sidoh.  :)

MyndFyre

Using HttpWebRequest, you don't need to worry about all that.  You just need to manage the Content-Type and the contents.  You can also hack User-Agent if you want to spoof a browser.
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

abc

Quote from: MyndFyre on August 02, 2008, 12:04:42 AM
Using HttpWebRequest, you don't need to worry about all that.  You just need to manage the Content-Type and the contents.  You can also hack User-Agent if you want to spoof a browser.

alright cool, that's what I've been doing

        req.Method = "POST";
            req.UserAgent = "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1";
            req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            req.Headers.Add("Accept-Language: en-us,en;q=0.5");
            req.Headers.Add("Accept-Encoding: gzip,deflate");
            req.Headers.Add("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7");
            req.KeepAlive = true;
            req.Connection = "300";
            req.Referer = "somesite.com/whatever";
            req.ContentType = "application/x-www-form-urlencoded";

MyndFyre

so that would wned up having stuff like:

User-Agent: User-Agent: Mozilla/5.0

Don't be silly ;)
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

abc

Quote from: MyndFyre on August 02, 2008, 03:07:43 AM
so that would wned up having stuff like:

User-Agent: User-Agent: Mozilla/5.0

Don't be silly ;)

ah, silly me!  :D