我需要在会话过期时使用MVC4,AngularJS和typescript显示自定义弹出消息。我有一个会话属性如下:
public class UserSessionAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext filterContext)
{
var controller = ((BaseApiController)filterContext.ControllerContext.Controller);
var userInfo = controller.SessionState.Get<UserSessionInfo>("UserSessionInfo");
if (userInfo == null)
{
// throw new HttpException(401, "Session Expired");
}
controller.UserSessionInfo = userInfo;
base.OnActionExecuting(filterContext);
}
}
并在方法中使用它,例如:
[UserSession]
public Person EditPerson(Person person)
{
}
现在,当会话过期时,我想显示一个带有刷新按钮的自定义弹出窗口。
知道如何实现这个吗?我看到了这个但需要更多信息http://forums.asp.net/t/1630594.aspx
答案 0 :(得分:0)
知道如何实现这个吗?
您可以通过添加到401 / Session Expired
/ catch
/ $http.get
/ put
的{{1}}来处理错误post
。所有这些都回报了一个承诺。