Open Source Web Application Framework for ASP.NET Core
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.
 
 
 
 
 
 

47 lines
1.5 KiB

using System.Threading.Tasks;
using IdentityServer4.Models;
using IdentityServer4.Services;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Views.Error;
using Volo.Abp.Http;
namespace Volo.Abp.Account.Web.Controllers
{
[Area("account")]
public class ErrorController : AbpController
{
private readonly IIdentityServerInteractionService _interaction;
private readonly IWebHostEnvironment _environment;
public ErrorController(
IIdentityServerInteractionService interaction,
IWebHostEnvironment environment)
{
_interaction = interaction;
_environment = environment;
}
public async Task<IActionResult> Index(string errorId)
{
var errorMessage = await _interaction.GetErrorContextAsync(errorId) ?? new ErrorMessage
{
Error = L["Error"]
};
if (!_environment.IsDevelopment())
{
// Only show in development
errorMessage.ErrorDescription = null;
}
return View("~/Views/Error/Default.cshtml", new AbpErrorViewModel
{
ErrorInfo = new RemoteServiceErrorInfo(errorMessage.Error, errorMessage.ErrorDescription),
HttpStatusCode = 500
});
}
}
}