开发者

ajax and security controller

I'm using jQuery Ajax to post and when success get the data and replace some items that works well if I add some security to the controller like that

[Authorize开发者_JAVA百科]
public ActionResult .........

If the user logged in everything go OK but when the user not logged or not authorized it should be redirected to the login page

As I'm using Ajax and it not ordinary post the user will not redirect to log in a window? What can I do to solve this problem? Or how can I know that the user isn't authorized before post with java to display an alert to tell the user to log in or the role didn't match?


I think these two questions can provide enough info to set you in the right direction.

  1. Asp MVC [Authorize] to return a Post instead of a Get
  2. More control on ASP.Net MVC's Authorize; to keep AJAX requests AJAXy
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜