This is a migrated thread and some comments may be shown as answers.

Fiddlerscript - reuse login session

3 Answers 174 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
Kris
Top achievements
Rank 1
Kris asked on 03 Jun 2016, 11:59 AM

Hi,

I'm rather new to fiddlerscript and webrequests but I have the following case.

I'm reading a file with a batch of webrequest and want to execute them to see if the httpresult is 200 or not.  This works fine for webrequest where I don't need to login for the application.  But if I want to do this for an application where I have to login first I don't get it to work.  I make a request to login and the status is 302 and everything seems to be ok, but if I afterwards want to call a normal webrequest it doesn't give me a 200...  I think because that last request isn't using the result of the login request.  Is it possible to achieve this and how do I achieve this.  Maybe there is an example on the internet?

 

Any help is welcome, thanks

Kris

 

3 Answers, 1 is accepted

Sort by
0
Kris
Top achievements
Rank 1
answered on 03 Jun 2016, 04:32 PM

After a bit of investigation I think I have to use the cookies from the response in the following/subsequent request.  I know how I can set a new request header but I don't know how I can capture/get the value of the cookie from the response header.  Can anyone please help me out.

Thx
Kris

0
Tsviatko Yovtchev
Telerik team
answered on 09 Jun 2016, 05:26 PM
Hi Kris,

You can read the cookies in the login response in the OnBeforeResponse like this: oSession.oResponse["Set-Cookie"]. That will return a column separated list of cookies. You have to store the ones you'd like to send back and then append them to the Cookie header of the matching request in the OnBeforeRequest like this : oSession.oRequest["Cookie"] = (oSession.oRequest["Cookie"] + ";YourCookieString");

Regards,
Tsviatko Yovtchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kris
Top achievements
Rank 1
answered on 05 Jul 2016, 02:17 PM

Thanks,

This solved my issue.

Regards
Kris

Tags
Fiddler Classic
Asked by
Kris
Top achievements
Rank 1
Answers by
Kris
Top achievements
Rank 1
Tsviatko Yovtchev
Telerik team
Kris
Top achievements
Rank 1
Share this question
or