This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AjaxOnlyAttribute : ActionMethodSelectorAttribute | |
{ | |
public override Boolean IsValidForRequest( | |
ControllerContext controllerContext, MethodInfo methodInfo) | |
{ | |
return controllerContext.HttpContext.Request.IsAjaxRequest(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BrowserSpecificAttribute : ActionFilterAttribute | |
{ | |
public override void OnResultExecuting(ResultExecutingContext filterContext) | |
{ | |
var viewResult = filterContext.Result as ViewResult; | |
if (viewResult == null) | |
return; | |
// Figure out the view name | |
var context = filterContext.Controller.ControllerContext; | |
var viewName = viewResult.ViewName; |
NewerOlder