Пример #1
0
		// Constructors
		
		static WebRequest ()
		{
#if NET_2_1
			IWebRequestCreate http = new HttpRequestCreator ();
			RegisterPrefix ("http", http);
			RegisterPrefix ("https", http);
	#if MOBILE
			RegisterPrefix ("file", new FileWebRequestCreator ());
			RegisterPrefix ("ftp", new FtpRequestCreator ());
	#endif
#else
			defaultCachePolicy = new HttpRequestCachePolicy (HttpRequestCacheLevel.NoCacheNoStore);
	#if CONFIGURATION_DEP
			object cfg = ConfigurationManager.GetSection ("system.net/webRequestModules");
			WebRequestModulesSection s = cfg as WebRequestModulesSection;
			if (s != null) {
				foreach (WebRequestModuleElement el in
					 s.WebRequestModules)
					AddPrefix (el.Prefix, el.Type);
				return;
			}
	#endif
			ConfigurationSettings.GetConfig ("system.net/webRequestModules");
#endif
		}
Пример #2
0
        static WebRequest()
        {
#if MOBILE || SSHARP
            IWebRequestCreate http = new HttpRequestCreator();
            RegisterPrefix("http", http);
            RegisterPrefix("https", http);
            RegisterPrefix("file", new FileWebRequestCreator());
            RegisterPrefix("ftp", new FtpRequestCreator());
#else
#if CONFIGURATION_DEP
            object cfg = ConfigurationManager.GetSection("system.net/webRequestModules");
            WebRequestModulesSection s = cfg as WebRequestModulesSection;
            if (s != null)
            {
                foreach (WebRequestModuleElement el in
                         s.WebRequestModules)
                {
                    AddPrefix(el.Prefix, el.Type);
                }
                return;
            }
        #endif
            ConfigurationSettings.GetConfig("system.net/webRequestModules");
#endif
        }
Пример #3
0
        // Constructors

        static WebRequest()
        {
#if MONOTOUCH
            AddPrefix("http", typeof(HttpRequestCreator));
            AddPrefix("https", typeof(HttpRequestCreator));
            AddPrefix("file", typeof(FileWebRequestCreator));
            AddPrefix("ftp", typeof(FtpRequestCreator));
#else
        #if NET_2_0
            defaultCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
        #endif
#if NET_2_0 && CONFIGURATION_DEP
            object cfg = ConfigurationManager.GetSection("system.net/webRequestModules");
            WebRequestModulesSection s = cfg as WebRequestModulesSection;
            if (s != null)
            {
                foreach (WebRequestModuleElement el in
                         s.WebRequestModules)
                {
                    AddPrefix(el.Prefix, el.Type);
                }
                return;
            }
#endif
            ConfigurationSettings.GetConfig("system.net/webRequestModules");
#endif
        }
Пример #4
0
            static internal WebRequestModulesSectionInternal GetSection()
            {
                lock (WebRequestModulesSectionInternal.ClassSyncObject)
                {
                    WebRequestModulesSection section = PrivilegedConfigurationManager.GetSection(WebRequestModulesSectionPath) as WebRequestModulesSection;
                    if (section == null)
                    {
                        return(null);
                    }

                    return(new WebRequestModulesSectionInternal(section));
                }
            }
Пример #5
0
        // Constructors

        static WebRequest()
        {
#if NET_2_0 && CONFIGURATION_DEP
            object cfg = ConfigurationManager.GetSection("system.net/webRequestModules");
            WebRequestModulesSection s = cfg as WebRequestModulesSection;
            if (s != null)
            {
                foreach (WebRequestModuleElement el in
                         s.WebRequestModules)
                {
                    AddPrefix(el.Prefix, el.Type);
                }
                return;
            }
#endif
            ConfigurationSettings.GetConfig("system.net/webRequestModules");
        }
Пример #6
0
 internal WebRequestModulesSectionInternal(WebRequestModulesSection section)
 {
     if (section.WebRequestModules.Count > 0)
     {
         this.webRequestModules = new ArrayList(section.WebRequestModules.Count);
         foreach (WebRequestModuleElement webRequestModuleElement in section.WebRequestModules)
         {
             try
             {
                 this.webRequestModules.Add(new WebRequestPrefixElement(webRequestModuleElement.Prefix, webRequestModuleElement.Type));
             }
             catch
             {
                 throw;
             }
         }
     }
 }
Пример #7
0
        // Constructors

        static WebRequest()
        {
            if (Platform.IsMacOS)
            {
#if MONOTOUCH
                Type type = Type.GetType("MonoTouch.CoreFoundation.CFNetwork, monotouch");
#else
                Type type = Type.GetType("MonoMac.CoreFoundation.CFNetwork, monomac");
#endif
                if (type != null)
                {
                    cfGetDefaultProxy = type.GetMethod("GetDefaultProxy");
                }
            }

#if NET_2_1
            IWebRequestCreate http = new HttpRequestCreator();
            RegisterPrefix("http", http);
            RegisterPrefix("https", http);
        #if MOBILE
            RegisterPrefix("file", new FileWebRequestCreator());
            RegisterPrefix("ftp", new FtpRequestCreator());
        #endif
#else
        #if NET_2_0
            defaultCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
        #endif
        #if NET_2_0 && CONFIGURATION_DEP
            object cfg = ConfigurationManager.GetSection("system.net/webRequestModules");
            WebRequestModulesSection s = cfg as WebRequestModulesSection;
            if (s != null)
            {
                foreach (WebRequestModuleElement el in
                         s.WebRequestModules)
                {
                    AddPrefix(el.Prefix, el.Type);
                }
                return;
            }
        #endif
            ConfigurationSettings.GetConfig("system.net/webRequestModules");
#endif
        }
Пример #8
0
        static ArrayList PopulatePrefixList()
        {
            var res = new ArrayList();

#if MOBILE || !CONFIGURATION_DEP
            IWebRequestCreate http = new HttpRequestCreator();
            res.Add(new WebRequestPrefixElement("http", http));
            res.Add(new WebRequestPrefixElement("https", http));
            res.Add(new WebRequestPrefixElement("file", new FileWebRequestCreator()));
            res.Add(new WebRequestPrefixElement("ftp", new FtpRequestCreator()));
#else
            object cfg = ConfigurationManager.GetSection("system.net/webRequestModules");
            WebRequestModulesSection s = cfg as WebRequestModulesSection;
            if (s != null)
            {
                foreach (WebRequestModuleElement el in s.WebRequestModules)
                {
                    res.Add(new WebRequestPrefixElement(el.Prefix, el.Type));
                }
            }
#endif
            return(res);
        }
Пример #9
0
        // Constructors

        static WebRequest()
        {
 #if MONOTOUCH
            AddDynamicPrefix("http", "HttpRequestCreator");
            AddDynamicPrefix("https", "HttpRequestCreator");
            AddDynamicPrefix("file", "FileWebRequestCreator");
            AddDynamicPrefix("ftp", "FtpRequestCreator");
 #else
  #if NET_2_0 && CONFIGURATION_DEP
            object cfg = ConfigurationManager.GetSection("system.net/webRequestModules");
            WebRequestModulesSection s = cfg as WebRequestModulesSection;
            if (s != null)
            {
                foreach (WebRequestModuleElement el in
                         s.WebRequestModules)
                {
                    AddPrefix(el.Prefix, el.Type);
                }
                return;
            }
  #endif
            ConfigurationSettings.GetConfig("system.net/webRequestModules");
 #endif
        }