本文整理汇总了C#中System.Web.HttpContextBase.IsAjax方法的典型用法代码示例。如果您正苦于以下问题:C# HttpContextBase.IsAjax方法的具体用法?C# HttpContextBase.IsAjax怎么用?C# HttpContextBase.IsAjax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpContextBase
的用法示例。
在下文中一共展示了HttpContextBase.IsAjax方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostReleaseRequestState
//14
private static void PostReleaseRequestState(HttpContextBase context)
{
if (!RequestValidator.IsValid(context, LifecycleEvent.PostReleaseRequestState)) return;
if (!context.IsAjax())
context.Response.Filter = new GlimpseResponseFilter(context.Response.Filter, context);
Logger.Info("PostReleaseRequestState handling complete for requestId " + context.GetGlimpseRequestId() + " (" + context.Request.Path + ")");
}
示例2: AppendToResponse
private static void AppendToResponse(HttpContextBase context, string json)
{
var requestId = context.GetGlimpseRequestId().ToString();
if (context.IsAjax())
{
Logger.Info("Ajax request, adding HTTP Header for requestId " + context.GetGlimpseRequestId() + " (" + context.Request.Path + ")");
context.Response.AddHeader(GlimpseConstants.HttpHeader, requestId);
}
else
{
if (context.GetGlimpseMode() == GlimpseMode.On)
{
//var path = VirtualPathUtility.ToAbsolute("~/", context.Request.ApplicationPath);
var path = context.GlimpseResourcePath("");
var html = string.Format(@"<script type='text/javascript' id='glimpseData' data-glimpse-requestID='{1}'>var glimpse = {0}, glimpsePath = '{2}';</script>", json, requestId, path);
html += @"<script type='text/javascript' id='glimpseClient' src='" + context.GlimpseResourcePath("client.js") + "'></script>";
context.Response.Write(html);//TODO: Use a filter and put this inside </body>
}
}
}