Created
February 17, 2011 01:55
-
-
Save c1982/830783 to your computer and use it in GitHub Desktop.
This file contains 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