Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Displaying Error page to users

$
0
0

Hi, i'm wondering how i can display the error page found in the shared views folder when 1) an exception is thrown 2) i want to redirect there with an error message that happened outside a catch block.

I'm not sure how it's activated. So if I do this and get an exception:

try
{
    await emailSender.SendEmailAsync("johan.herstad@gmail.com", "Waffles recipe", text);
}
catch (Exception ex)
{
    throw new ApplicationException($"Something went wrong '{ex.Message}'.");
}

Will the error page display in production with that message? Because I don't get that error page in development.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>