I have this scenario:
$siteurl = 'http://somepage.com' $r1 = Invoke-WebRequest -Uri ($siteurl+'/login') -SessionVariable mysession $r1.Forms.Fields['Login']='admin' $r1.Forms.Fields['Password']='password' $r2 = Invoke-WebRequest -Uri ($siteurl+$r1.forms.Action) - WebSession $mysession -Method Post -Body $r1.Forms.Fields
...and I can't login because while I get redirected within $r2 request
request: GET /Login response: 200 OK response: Set-Cookie Cookie1 request: GET /Login-Proceed (Action url) request: Cookie: Cookie1 response: 302, Location /Main response: Set-Cookie Cookie2 request: GET /Main request: Cookie: Cookie1 !!!!!! request: Cookie: Cookie2 missed here !!!!!
IE set both cookies on this stage
Anyone already meet these problems ? Any thoughts, workarounds ?
(yes, i know about COM IE object, System.Net.WebClient and so on, but I hoped to use the generic way 🙂
for those who are interested, a quick and dirty workaround
not well tested but suitable for my needs
You must be logged in to reply to this topic.