Guest User

Untitled

a guest
Jan 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. public class HomeController : MyBaseController
  2. {
  3. public ActionResult Index()
  4. {
  5. ViewBag.Message = "Welcome to ASP.NET MVC!";
  6.  
  7.  
  8. return View();
  9. }
  10.  
  11. public ActionResult About()
  12. {
  13. return View();
  14. }
  15.  
  16. protected override void OnActionExecuting(ActionExecutingContext filterContext)
  17. {
  18. filterContext.HttpContext.Response.Write("HomeController Here ");
  19. base.OnActionExecuting(filterContext);
  20. }
  21. }
  22.  
  23. [ForceLogin]
  24. public class MyBaseController : Controller
  25. {
  26. protected override void OnActionExecuting(ActionExecutingContext filterContext)
  27. {
  28. filterContext.HttpContext.Response.Write("MyBaseController Here ");
  29. base.OnActionExecuting(filterContext);
  30. }
  31. }
  32. public class ForceLoginAttribute : ActionFilterAttribute
  33. {
  34. public override void OnActionExecuting(ActionExecutingContext filterContext)
  35. {
  36. filterContext.HttpContext.Response.Write("ForceLoginAttribute Here ");
  37. base.OnActionExecuting(filterContext);
  38. }
  39. }
Add Comment
Please, Sign In to add comment