Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
WinHttpDetectAutoProxyUrl (winhttp)

Get pac url from DHCP or DNS.

C# Signature:

[DllImport("winhttp.dll", SetLastError = true, CharSet = CharSet.Unicode)]

[return: MarshalAs(UnmanagedType.Bool)]

public static extern Boolean WinHttpDetectAutoProxyConfigUrl(

    UInt32 dwAutoDetectFlags,
    [MarshalAs(UnmanagedType.LPWStr)] out String ppwstrAutoConfigUrl


VB Signature:

Declare Function WinHttpDetectAutoProxyUrl Lib "winhttp.dll" (TODO) As TODO

User-Defined Types:


Alternative Managed API:

Do you know one? Please contribute it!


Values for dwAutoDetectFlags :

    UInt32 WINHTTP_AUTO_DETECT_TYPE_DHCP = 0x00000001;
    UInt32 WINHTTP_AUTO_DETECT_TYPE_DNS_A = 0x00000002;

or both


If both the DHCP and DNS auto detect flags are set, DHCP is used first; if no PAC URL is discovered using DHCP, then DNS is used

Tips & Tricks:

Please add some!

Sample Code:

Please add some!


Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Find References
Show Printable Version