Asp.net Mvc custom mechanism to handle unauthorized request

Viewed 13588

For my website i want following behaviors for secured controller(or action)

if a user makes a normal request redirect to login page (which i have easily able to do)

if request is Ajax type Request.IsAjaxRequest()==true, return status code 401

How can i create a filter for this??

6 Answers
Related