How to set a proxy auto-configuration script (.pac) to be used in C#?

让人想犯罪 __ 提交于 2019-12-11 04:03:52

问题


I'm starting to write some very simple web-apps in C# and occasionally I get exceptions about not having a proxy configured. I am in a work environment that has a rather strict proxy auto-configuration file (.pac -- Proxy Auto-Config).

Is there a way to tell C# to use that .pac file for proxy settings?


回答1:


.NET can use the default proxy settings of the user running the code. It uses the same settings that are defined for IE. See this article: https://msdn.microsoft.com/en-us/library/dkwyc043%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

You should also see this SO post about MIME types for the PAC file: Using Proxy Automatic Configuration from IE Settings in .Net



来源:https://stackoverflow.com/questions/31145063/how-to-set-a-proxy-auto-configuration-script-pac-to-be-used-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!