/// <summary> /// 重定向方法(ajax和link) /// </summary> /// <param name="url">重定向的url</param> /// <param name="action">产生重定向的action方法</param> /// <returns>JSONRESULT REDIRECTRESULT</returns> public ActionResult Redirect(string url, ActionDescriptor action, AjaxStatu ajaxStatu = AjaxStatu.noperm) { //如果是Ajax请求没有权限,那么就返回Json消息 if (action.IsDefined(typeof(Common.Attributes.AjaxRequestAttribute), false) || action.ControllerDescriptor.IsDefined(typeof(Common.Attributes.AjaxRequestAttribute), false)) { if (ajaxStatu == AjaxStatu.nologin) { return(PackagingAjaxmsg(AjaxStatu.nologin, Message.NotLogin, null, url)); } else if (ajaxStatu == AjaxStatu.none) { return(PackagingAjaxmsg(AjaxStatu.nologin, Message.NotNone, null, url)); } else { string strAction = action.GetDescription(); string strController = action.ControllerDescriptor.GetDescription(); string msg = string.Format(Message.OptNoPermission, strAction); return(PackagingAjaxmsg(AjaxStatu.noperm, msg, null, null)); } } else//如果是超链接或表单 { return(new RedirectResult(url)); } }