-
-
Save LSTANCZYK/47452af89445e7e0935fc5e462d3b82c to your computer and use it in GitHub Desktop.
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
| using System.Web.Mvc; | |
| namespace MvcApplication1.Models | |
| { | |
| public class CheckBrowserAttribute : ActionFilterAttribute | |
| { | |
| public override void OnActionExecuted(ActionExecutedContext filterContext) | |
| { | |
| base.OnActionExecuted(filterContext); | |
| } | |
| public override void OnActionExecuting(ActionExecutingContext filterContext) | |
| { | |
| var userAgent = filterContext.HttpContext.Request.ServerVariables["HTTP_USER_AGENT"]; | |
| if (userAgent.IndexOf("MSIE") != -1) | |
| filterContext.Result = new ContentResult() | |
| { Content = "<script>alert('YASAK! FireFox veya Chrome kullanın.');</script>" }; | |
| base.OnActionExecuting(filterContext); | |
| } | |
| public override void OnResultExecuted(ResultExecutedContext filterContext) | |
| { | |
| base.OnResultExecuted(filterContext); | |
| } | |
| public override void OnResultExecuting(ResultExecutingContext filterContext) | |
| { | |
| base.OnResultExecuting(filterContext); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment