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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. namespace Teknik.Areas.Error.Controllers
  9. {
  10. public class ErrorController : DefaultController
  11. {
  12. [AllowAnonymous]
  13. public ActionResult Exception(Exception exception)
  14. {
  15. ViewBag.Title = "Exception - " + Config.Title;
  16. if (Response != null)
  17. Response.StatusCode = 200;
  18. ErrorViewModel model = new ErrorViewModel();
  19. model.Exception = exception;
  20. return View(model);
  21. }
  22. [AllowAnonymous]
  23. public ActionResult General(Exception exception)
  24. {
  25. ViewBag.Title = "Http Exception - " + Config.Title;
  26. ErrorViewModel model = new ErrorViewModel();
  27. model.Description = exception.Message;
  28. model.Exception = exception;
  29. return View(model);
  30. }
  31. [AllowAnonymous]
  32. public ActionResult Http403(Exception exception)
  33. {
  34. ViewBag.Title = "403 - " + Config.Title;
  35. ViewBag.Message = "Access Denied";
  36. ErrorViewModel model = new ErrorViewModel();
  37. model.Exception = exception;
  38. return View(model);
  39. }
  40. [AllowAnonymous]
  41. public ActionResult Http404(Exception exception)
  42. {
  43. ViewBag.Title = "404 - " + Config.Title;
  44. ViewBag.Message = "Uh Oh, can't find it!";
  45. ErrorViewModel model = new ErrorViewModel();
  46. model.Exception = exception;
  47. return View(model);
  48. }
  49. [AllowAnonymous]
  50. public ActionResult Http500(Exception exception)
  51. {
  52. ViewBag.Title = "500 - " + Config.Title;
  53. ViewBag.Message = "Something Borked";
  54. ErrorViewModel model = new ErrorViewModel();
  55. model.Exception = exception;
  56. return View(model);
  57. }
  58. }
  59. }