ASP.NET 如何判断当前请求是否是Ajax请求
/// <summary>
/// Description:验证用户是否登陆
/// Author:xucixiao
/// Date:2013-10-26
/// </summary>
/// <param name="filterContext"></param>
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
string lsURL = System.Configuration.ConfigurationManager.AppSettings["siteURL"];
if (Session["user_"] == null)
{
if (filterContext.HttpContext.Request.IsAjaxRequest())
{
filterContext.Result = new ContentResult() { Content = "-10" };
}
else
{
filterContext.HttpContext.Response.Redirect(lsURL);
}
}
}
阿里云: www.aliyun.com
华赐软件: www.huacisoft.com
C#开源社区: www.opencsharp.net
清泓美肤苑: 清泓美肤苑
bootstrap权限管理系统: Asp.Net Mvc3 bootstrap权限管理系统