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


C# IMansionContext.GetWebOuputPipe方法代码示例

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


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

示例1: DoExecute

        /// <summary>
        /// Executes this tag.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        protected override void DoExecute(IMansionContext context)
        {
            // get the current output pipe
            var outputPipe = context.GetWebOuputPipe();

            // get the status code
            outputPipe.Response.StatusCode = (HttpStatusCode) GetRequiredAttribute<int>(context, "code");
            string description;
            if (TryGetAttribute(context, "description", out description))
                outputPipe.Response.StatusDescription = description;
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:15,代码来源:SetStatusCodeTag.cs

示例2: DoExecute

        /// <summary>
        /// Executes this tag.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        protected override void DoExecute(IMansionContext context)
        {
            // get the output pipe
            var outputPipe = context.GetWebOuputPipe();

            // set the properties of the output pipe
            outputPipe.Response.ContentType = GetAttribute(context, "contentType", "text/html");
            outputPipe.Encoding = GetAttribute(context, "encoding", Encoding.UTF8);
            outputPipe.Response.CacheSettings.OutputCacheEnabled = GetAttribute(context, "cache", true);

            // execute the children
            ExecuteChildTags(context);
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:17,代码来源:RespondDocumentTag.cs

示例3: RouteTo404Controller

		/// <summary>
		/// Routes the request to the 404 controller action.
		/// </summary>
		/// <param name="context">The <see cref="MansionContext"/>.</param>
		/// <param name="route">The <see cref="IPropertyBag"/> containing the route.</param>
		/// <param name="areaName">The name of the area in which the controller lives.</param>
		/// <param name="controllerName">The name of the controller.</param>
		/// <param name="actionName">The name of the action which to invoke.</param>
		private void RouteTo404Controller(IMansionContext context, IPropertyBag route, string areaName, string controllerName, string actionName)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (route == null)
				throw new ArgumentNullException("route");
			if (areaName == null)
				throw new ArgumentNullException("areaName");
			if (string.IsNullOrEmpty(controllerName))
				throw new ArgumentNullException("controllerName");
			if (string.IsNullOrEmpty(actionName))
				throw new ArgumentNullException("actionName");

			// guard against endless routing
			if ("404".Equals(controllerName))
			{
				context.GetWebOuputPipe().Response.StatusCode = HttpStatusCode.NotFound;
				context.BreakExecution = true;
				return;
			}

			// route to controller
			RouteToControllerAction(context, route, string.Empty, "404", "NotFound");
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:33,代码来源:InvokeActionTag.cs

示例4: RedirectRequest

        /// <summary>
        /// Redirects the request to the target <paramref name="url"/>. Disables the response and output caches and halts the script execution.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        /// <param name="url">The <see cref="Url"/> to which to redirect.</param>
        /// <param name="permanent">Flag indicating whether the redirect is permanent or not.</param>
        public static void RedirectRequest(IMansionContext context, Url url, bool permanent = false)
        {
            // get the output pipe
            var webOutputPipe = context.GetWebOuputPipe();

            // disable the caches
            DisableOutputCache(context);
            DisableResponseTemplateCache(context);

            // set redirect
            webOutputPipe.Response.RedirectLocation = url;
            webOutputPipe.Response.StatusCode = permanent ? HttpStatusCode.MovedPermanently : HttpStatusCode.Found;

            // halt execution
            context.BreakExecution = true;
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:22,代码来源:WebUtilities.cs

示例5: DisableOutputCache

        /// <summary>
        /// Disables the output cache of the current request.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        public static void DisableOutputCache(IMansionContext context)
        {
            // validate arguments
            if (context == null)
                throw new ArgumentNullException("context");

            // get the output pipe
            var webOutputPipe = context.GetWebOuputPipe();

            // disable the cache
            webOutputPipe.Response.CacheSettings.OutputCacheEnabled = false;
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:16,代码来源:WebUtilities.cs


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