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

Throw new Exception (Internal server error)

$
0
0

Hi folks,
I am using asp.net core Web API with Angular 2.

here is my sample code,

private IActionResult GetErrorResultLogin(Microsoft.AspNetCore.Identity.SignInResult result)
{
    string errorMsg = "";
    if (!result.Succeeded)
    {
        errorMsg += "Could not logged in. Please check your user/password.";
    }
    throw new Exception(errorMsg);
}

I am getting display output like this:

So i copy/paste and save as html.

I do not want Internal server error info as html view page.
i want to display only error message  "Could not logged in. Please check your user/password."
how to fix it?

I am waiting for your response.
Thanks in advance!!!


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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