Fiddlerscript - reuse login session

4 posts, 0 answers
  1. Kris
    Kris avatar
    2 posts
    Member since:
    Sep 2015

    Posted 03 Jun Link to this post

    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

     

  2. Kris
    Kris avatar
    2 posts
    Member since:
    Sep 2015

    Posted 03 Jun in reply to Kris Link to this post

    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

  3. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 09 Jun Link to this post

    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
  4. Kris
    Kris avatar
    1 posts
    Member since:
    Feb 2014

    Posted 05 Jul in reply to Tsviatko Yovtchev Link to this post

    Thanks,

    This solved my issue.

    Regards
    Kris

Back to Top