2009-06-21 13 views
6

MSDNDetectar configuración de proxy del navegador web por defecto muestra

HttpWebRequest myWebRequest=(HttpWebRequest)WebRequest.Create("http://www.microsoft.com"); 
WebProxy myProxy=new WebProxy(); 
// Obtain the 'Proxy' of the Default browser. 
myProxy=(WebProxy)myWebRequest.Proxy; 

no funciona. El error que recibo es: No se puede convertir el objeto de tipo 'WebProxyWrapper' para escribir 'System.Net.WebProxy'

¿Qué opciones tengo?

Respuesta

-2

para comprobar automáticamente detectar entorno, utilice el código:

RegistryKey registry = Registry.CurrentUser.OpenSubKey(
    "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true); 
registry.SetValue("ProxyEnable", 0); 
RegistryKey registry2 = Registry.CurrentUser.OpenSubKey(
    "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Connections", true); 
registry2.DeleteValue("DefaultConnectionSettings", false); 
registry2.DeleteValue("SavedLegacySettings", false); 
+0

Este código ciertamente no comprueba la configuración, pero los cambios y los borra. – psouza4

Cuestiones relacionadas