The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ErrorController.cs 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Teknik.Areas.Error.ViewModels;
  7. using Teknik.Controllers;
  8. using Teknik.Filters;
  9. namespace Teknik.Areas.Error.Controllers
  10. {
  11. public class ErrorController : DefaultController
  12. {
  13. [TrackPageView]
  14. [AllowAnonymous]
  15. public ActionResult Exception(Exception exception)
  16. {
  17. ViewBag.Title = "Exception - " + Config.Title;
  18. ViewBag.Description = "Just a boring 'ol exception. Nothing to see here, move along.";
  19. if (Response != null)
  20. Response.StatusCode = 200;
  21. ErrorViewModel model = new ErrorViewModel();
  22. model.Exception = exception;
  23. return View(model);
  24. }
  25. [TrackPageView]
  26. [AllowAnonymous]
  27. public ActionResult General(Exception exception)
  28. {
  29. ViewBag.Title = "Http Exception - " + Config.Title;
  30. ViewBag.Description = "There has been a Http exception. Run!";
  31. ErrorViewModel model = new ErrorViewModel();
  32. model.Description = exception.Message;
  33. model.Exception = exception;
  34. return View(model);
  35. }
  36. [TrackPageView]
  37. [AllowAnonymous]
  38. public ActionResult Http403(Exception exception)
  39. {
  40. ViewBag.Title = "403 - " + Config.Title;
  41. ViewBag.Description = "Access Denied";
  42. ErrorViewModel model = new ErrorViewModel();
  43. model.Exception = exception;
  44. return View(model);
  45. }
  46. [TrackPageView]
  47. [AllowAnonymous]
  48. public ActionResult Http404(Exception exception)
  49. {
  50. ViewBag.Title = "404 - " + Config.Title;
  51. ViewBag.Description = "Uh Oh, can't find it!";
  52. ErrorViewModel model = new ErrorViewModel();
  53. model.Exception = exception;
  54. return View(model);
  55. }
  56. [TrackPageView]
  57. [AllowAnonymous]
  58. public ActionResult Http500(Exception exception)
  59. {
  60. ViewBag.Title = "500 - " + Config.Title;
  61. ViewBag.Description = "Something Borked";
  62. ErrorViewModel model = new ErrorViewModel();
  63. model.Exception = exception;
  64. return View(model);
  65. }
  66. }
  67. }