| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using Abp.AspNetCore.Mvc.Controllers;
- using Abp.Web.Models;
- using Abp.Web.Mvc.Models;
- using Microsoft.AspNetCore.Diagnostics;
- using Microsoft.AspNetCore.Mvc;
- namespace VberAdmin.Controllers;
- public class ErrorController : AbpController
- {
- private readonly IErrorInfoBuilder _errorInfoBuilder;
- public ErrorController(IErrorInfoBuilder errorInfoBuilder)
- {
- _errorInfoBuilder = errorInfoBuilder;
- }
- public ActionResult Index(int statusCode = 0)
- {
- if (statusCode == 404)
- {
- return E404();
- }
- if (statusCode == 403)
- {
- return E403();
- }
- var exHandlerFeature = HttpContext.Features.Get<IExceptionHandlerFeature>();
- var exception = exHandlerFeature != null
- ? exHandlerFeature.Error
- : new Exception("Unhandled exception!");
- return View(
- "Error",
- new ErrorViewModel(
- _errorInfoBuilder.BuildForException(exception),
- exception
- )
- );
- }
- public ActionResult E403()
- {
- return View("Error403");
- }
- public ActionResult E404()
- {
- return View("Error404");
- }
- }
|