当前位置: 首页>>代码示例>>C#>>正文


C# HttpContext.GetConfig方法代码示例

本文整理汇总了C#中System.Web.HttpContext.GetConfig方法的典型用法代码示例。如果您正苦于以下问题:C# HttpContext.GetConfig方法的具体用法?C# HttpContext.GetConfig怎么用?C# HttpContext.GetConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.HttpContext的用法示例。


在下文中一共展示了HttpContext.GetConfig方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetScriptLocation

		internal static string GetScriptLocation(HttpContext context)
		{
			IDictionary dict = context.GetConfig("system.web/webControls")
			                    as IDictionary;
			string loc = null;
			if(dict != null)
			{
				loc = dict["clientScriptsLocation"] as string;
			}
			if(loc == null)
			{
				throw new HttpException("Missing_clientScriptsLocation");
			}
			if(loc.IndexOf("{0}") > 0)
			{
				//FIXME: Version Number of the ASP.Net should come into play.
				//Like if ASP 1.0 and 1.1 both are installed, the script
				// locations are in /aspnet_client/system_web/1_0_3705_0/
				// and /aspnet_client/system_web/1_1_4322/
				// (these entries are from my machine
				// So, first I should get this Version Info from somewhere
				loc = String.Format(loc, "system_web");
			}
			return loc;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:25,代码来源:Utils.cs

示例2: GetInstance

		static public CompilationConfiguration GetInstance (HttpContext context)
		{
			CompilationConfiguration config;
			if (context == null)
				context = HttpContext.Context;

			config = context.GetConfig ("system.web/compilation") as CompilationConfiguration;

			if (config == null)
				throw new Exception ("Configuration error.");

			return config;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:13,代码来源:CompilationConfiguration.cs

示例3: GetInstance

		static public HttpRuntimeConfig GetInstance (HttpContext context)
		{
			HttpRuntimeConfig config;
			if (context == null)
				context = HttpContext.Context;

			config = context.GetConfig ("system.web/httpRuntime") as HttpRuntimeConfig;

			if (config == null)
				throw new Exception ("Configuration error.");

			return config;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:13,代码来源:HttpRuntimeConfig.cs

示例4: GetInstance

		static public CompilationConfiguration GetInstance (HttpContext context)
		{
			CompilationConfiguration config;
			if (context == null)
				context = HttpContext.Current;

			if (context != null) {
				config = context.GetConfig ("system.web/compilation") as CompilationConfiguration;
				if (config == null)
					throw new Exception ("Configuration error.");
			} else {
				// empty config (as used in unit tests)
				config = new CompilationConfiguration (null);
			}

			return config;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:17,代码来源:CompilationConfiguration.cs

示例5: RedirectCustomError

		bool RedirectCustomError (HttpContext context)
		{
			if (!context.IsCustomErrorEnabled)
				return false;

			CustomErrorsConfig config = null;
			try {
				config = (CustomErrorsConfig) context.GetConfig ("system.web/customErrors");
			} catch { }

			if (config == null) {
				if (context.ErrorPage != null)
					return context.Response.RedirectCustomError (context.ErrorPage);

				return false;
			}

			string redirect =  config [context.Response.StatusCode];
			if (redirect == null) {
				redirect = context.ErrorPage;
				if (redirect == null)
					redirect = config.DefaultRedirect;
			}

			if (redirect == null)
				return false;

			return context.Response.RedirectCustomError (redirect);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:29,代码来源:HttpRuntime.cs

示例6: FindCommonPath

        /// <summary>
        /// Finds the path for client files used be server controls.
        /// </summary>
        /// <param name="context">The context from which to get the configuration.</param>
        /// <returns>The path name.</returns>
        private static string FindCommonPath(HttpContext context)
        {
            // Look at the current configuration for the path
            if (context != null)
            {
                NameValueCollection table = (NameValueCollection)context.GetConfig(ConfigName);
                if (table != null)
                {
                    string path = (string)table[CommonFilesKey];
                    if (path != null)
                    {
                        return CleanupPath(path);
                    }
                }
            }

            // Return the default path with version number
            Assembly assembly = typeof(BaseRichControl).Assembly;
            Version version = assembly.GetName().Version;

            return DefaultCommonFilesRoot + version.Major.ToString() + "_" + version.Minor.ToString() + "/";
        }
开发者ID:padilhalino,项目名称:FrontDesk,代码行数:27,代码来源:BaseRichControl.cs


注:本文中的System.Web.HttpContext.GetConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。