本文整理匯總了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>
}
}
}