troubleshooting Question

asp.net MVC4 -- error messages ?

Avatar of finance_teacher
finance_teacher asked on
.NET ProgrammingC#ASP.NET
1 Comment1 Solution1105 ViewsLast Modified:
How can I change the below
\Views\Shared\Error.cshtml (etc)
to display REAL error messages ?
------------------------------------------------------------------------
@model System.Web.Mvc.HandleErrorInfo

@{
    ViewBag.Title = "Error";
}

<hgroup class="title">
    <h1 class="error">Error.</h1>
    <h2 class="error">An error occurred while processing your request.</h2>
</hgroup>
------------------------------------------------------------------------
I added the below to
\Views\Shared\Error.cshtml
but it did not work.

  Exception exc = Server.GetLastError();

    if (exc is HttpUnhandledException)
    {
        if (exc.InnerException != null)
        {
            exc = new Exception(exc.InnerException.Message);
            Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax",
                true);
        }
    }
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros