Fiddler: Respond to Requests Requiring a Client Ce

2019-06-26 07:47发布

问题:

I'm trying to scrape a website that first asks for a certificate. After you are authenticated it then will ask you to provide a username and password. Anyway I'm trying to use fiddler to see what i need to replicate and when i turn on it to "Capture traffic" and then I go to internet explorer and try to access the site it says " Internet Explorer cannot display the webpage " then when i turn off fiddler and try it again it brings me to the login page.

I've tried this link and i tried everything (Turning it into a .cer file and dragging into the folder also tried copy and pasting the code into the rule file to accept the certificate) and neither way worked. Does anyone have any other ideas.

Am I suppose to replace the fiddler root certificate somehow? or is there any solution that someone can suggest?

回答1:

I figured out this problem. Just incase this trips someone else up. The oSession bit of code needed to be the first line after the OnBeforeRequest line. I don't remember where it was before but it didn't work. Example:

 static function  OnBeforeRequest(oSession: Session) {
   oSession["https-Client-Certificate"]= "C:\\Yourcerfilelocation.cer"; 
 //I omitted the standard code

}

Edit: OnBeforeRequest is a better method to place it instead of OnPeekAtRequestHeaders.