Thank you very much McA for the example.

However when I tried this in my code, it seems the ASP sessionID is still missing in the cookie.

What's more, the response was an html page instead of the real data that it should be.

The web page it access seems needs two parts in the cookie, one is the ASP sessionID, the other is the mail address like thing as you could see from the cookie content.

Is the cookie not correctly accept when I put it into the GET request?

345 $dl_res = $ua->request( 346 GET $req_url, 347 Cookie => 'ASP.NET_SessionId=xaduwqpg5ocnenpb0l0xsq4d +; GMProfileInfo=e=xxxx@banana.com' 348 );
The real request it sent by looking from the debugger (the ASP Session +ID is not showing up but it should): '_request' => bless( { '_content' => '', '_uri' => bless( do{\(my $o = 'http://www.xxxx.xxx/pages/profil +e.aspx/pages/profile.aspx?src=http://xxxx.xxxx.xxx/protectedfiledownl +oad.aspx?dlfile=data_bulk/file.txt')}, 'URI::http' ), '_headers' => bless( { 'cookie2' => '$Version="1"', 'user-agent' => 'libwww-perl/5.804', 'cookie' => 'GMProfileInfo=e=xxxx@banana.com&i=536' }, 'HTTP::Headers' ), '_method' => 'GET' }, 'HTTP::Request' )

In reply to Re: Adding cookies into headers of LWP request by sylph001
in thread Adding cookies into headers of LWP request by sylph001

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.