Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit URL with Fiddler(script)?

Tags:

c#

fiddler

I want to edit a URL using fiddler. Doesn't have to be with fiddler script, but heres an approximation of how I'm doing it currently:

if (oSession.url.contains("example.com") {
  String oldUrl = oSession.url.ToString();
  Regex rgx = new Regex("1.2");
  String newUrl = rgx.Replace(oldUrl, "1.0");
}

This code is giving me a compiler error on the regex instantiation line: "The list of attributes does not apply to the current context". I'm not entirely sure what this means.

I'm also unsure how exactly to change the url.

Any ideas?

like image 368
user650309 Avatar asked Nov 05 '14 16:11

user650309


People also ask

How do you edit a Fiddler script?

Fiddler's default rules are stored in \Program Files\Fiddler2\Scripts\SampleRules. js. You can change the JScript editor launched from the Rules menu. Click Tools | Fiddler Options and edit the Editor string.


2 Answers

Just got it:

oSession.url = oSession.url.Replace("1.2","1.0");
like image 69
user650309 Avatar answered Oct 07 '22 12:10

user650309


You can also use

    oSession.PathAndQuery = oSession.PathAndQuery.replace('/test1/', '/changed1/');  
like image 31
Sikandar Avatar answered Oct 07 '22 12:10

Sikandar