Home  >  Article  >  Backend Development  >  C# Fiddler plug-in implements website offline browsing function graphic introduction

C# Fiddler plug-in implements website offline browsing function graphic introduction

黄舟
黄舟Original
2017-03-06 10:59:541609browse

This article mainly introduces the principles and methods of the C# Fiddler plug-in to implement the offline browsing function of the website. It has a very good reference value. Let’s take a look at it with the editor.

There is such an application scenario:

You are doing front-end or APP development, and you need to call the server. The interface can only be accessed within the company's intranet; the code cannot be debugged outside the company.

What should I do if I want to visit outside the company?

If you save the response content of all interfaces when you are in the company, you can simulate a server environment locally without the server, so that you can debug happily without being restricted by the network environment. code.

The implementation principle is as follows:

First use Fiddler to capture the packet, and save the interfaces you need to save (not limited to interfaces, html, css, js, image are all acceptable) Catch it again.

Click the following menu in Fiddler, File -> Save -> All Sessions, to save all captured requests as a saz file.

The saz file contains all the information of the request/response. It is a file in zip format. There will be files named as follows in the raw directory, for example:

001_c.txt, 001_s. txt, 001_m.xml

001 represents the request sequence number, for example: 001, 002, 003

001_c.txt is the complete information of the HTTP request (including request headers)

001_s .txt is the complete information of the HTTP response (including response headers)

001_m.xml is the relevant information of Fiddler Session (not used in this example)

With the request/response information, we You can write a Fiddler plug-in to replace all requests that can be matched in saz with corresponding responses, thereby realizing the offline browsing function.

The code is relatively simple so I won’t post it. The complete code is available for download later.

Let’s talk about the usage of the plug-in:

  1. Extract saz to a directory and paste it in the text box Directory path, multiple saz paths are separated by newlines. In fact, you can directly paste the saz file path here, and it is more convenient for the plug-in to automatically decompress it; I am too lazy to do it^_^

  2. Click "Save"

  3. Now access the previously captured address without leaving the server.

The above is the graphic introduction of the C# Fiddler plug-in to implement the offline browsing function of the website. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn