Retrieving Data from a PAC File

Is it possible to execute Javascript in a PAC file from a .Net windows application to return a proxy server?

+3
source share
1 answer

Since the proxy auto-config file is only the JavaScript source file, and you need to call the method in it, you can use the JScript.NET Compiler (available in code through JScriptCodeProvider ) and / or the interpreter (via JScriptEvaluate ).

Compiler: here is a sample code that compiles JScript.NET code into a class and then calls a method in that class , which may be well suited for what you are looking for. Note that it uses Reflection, so you may experience a problem if you are in a partial trust environment such as ASP.NET. I'm not sure if Reflection is required for this kind of access or is it just an implementation detail; if this is a problem for you, you can investigate it further or use the interpreter instead.

: , JScript- Microsoft.JScript.Eval.JScriptEvaluate. PAC , . , FindProxyForURL ; . , PAC, , ( JScriptEvaluate, , ).

+2

Source: https://habr.com/ru/post/1768219/


All Articles