Re: Logging into site and maintaining session?

Giganews Newsgroups
Subject: Re: Logging into site and maintaining session?
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Fri, 29 Apr 2005

"ielite" <ieli…@yahoo.net> wrote in message
news:C3F528CCF2C8E240ieli…@yahoo.net...

> How do i use TidHTTP (delphi) to login to this page, and
> retrieve the html of the page after login?

    var
        Params: TStringList;
        HTML: String;
    begin
        Params := TStringList.Create;
        try
            Params.Values['__VIEWSTATE'] :=
'dDw0OTk2MTk7dDxwPGw8TG9naW4uUmVkaXJlY3Q7PjtsPGh0dHA6Ly93d3cuZ2VvY2FjaGluZy5
jb20vRGVmYXVsdC5hc3B4Oz4+O2w8aTwwPjs+O2w8dDw7bDxpPDE+O2k8Mz47aTw2Pjs+O2w8dDx
wPHA8bDxUZXh0Oz47bDx5b3UgYXJlIG5vdCBsb2dnZWQgaW4uOz4+Oz47Oz47dDxwPHA8bDxOYXZ
pZ2F0ZVVybDtUZXh0Oz47bDxodHRwOi8vd3d3Lmdlb2NhY2hpbmcuY29tL2xvZ2luL2RlZmF1bHQ
uYXNweD9SRVNFVD1ZJnJlZGlyPWh0dHAlM2ElMmYlMmZ3d3cuZ2VvY2FjaGluZy5jb20lMmZsb2d
pbiUyZmRlZmF1bHQuYXNweCUzZlJFU0VUJTNkWSUyNnJlZGlyJTNkaHR0cCUyNTNhJTI1MmYlMjU
yZnd3dy5nZW9jYWNoaW5nLmNvbSUyNTJmRGVmYXVsdC5hc3B4O1w8Rk9OVCBjb2xvcj0iI0ZGRkY
wMCJcPmxvZyBpblw8L0ZPTlRcPjs+Pjs+Ozs+O3Q8O2w8aTwwPjs+O2w8dDxwPHA8bDxJbWFnZVV
ybDs+O2w8L2ltYWdlcy9uYXYvbG9nb19zdWIuZ2lmOz4+Oz47Oz47Pj47Pj47Pj47bDxjb29raWU
7Pj46wf8LRl35/l7foX5zy+tgotWI2g==';
            Params.Values['"myUsername'] := 'yourusername';
            Params.Values['myPassword'] := 'yourpassword';
            Params.Values['Button1'] := 'Login';
            Params.Values['cookie'] := 'ON';

            HTML :=
IdHTTP.Post(http://www.thesite.com/default.aspx?RESET=Y&redir=http%3a%2f%2f
www.GeoCaching.com%2fDefault.aspx', Params);

            // use HTML as needed...

        finally
            Params.Free;
        end;
    end;

Gambit

Replies

In response to

Logging into site and maintaining session? posted by ielite on Fri, 29 Apr 2005