All pastes #233273 Raw Edit

Something

public text v1 · immutable
·published 2006-11-01 21:20 UTC
rendered paste body
/*
 Proxy configuration file test 2.
 
 This demonstrates that Mono 2.0 does not respect machine.config ConfigurationManager.GetSection. Is this behaviour correct?
 
 Edit both 1.1 and 2.0 machine.configs to add <system.net><defaultProxy><proxy address="http://proxy.example.com" etc...
 Is the output proxy address blank?

*/

namespace ProxyTest2
{
	class MainClass
	{
		public static void Main (string[] args)
		{			
			System.Net.Configuration.DefaultProxySection sec = 
				System.Configuration.ConfigurationManager.GetSection ("system.net/defaultProxy") as System.Net.Configuration.DefaultProxySection;
			if (sec != null)
				System.Console.WriteLine ("1: Address is {0}", sec.Proxy.ProxyAddress);
			
			sec = System.Configuration.ConfigurationSettings.GetConfig ("system.net/defaultProxy") as System.Net.Configuration.DefaultProxySection;
			if (sec != null)
				System.Console.WriteLine ("2: Address is {0}", sec.Proxy.ProxyAddress);
		}
	}
}