A
A
Alexey Lebedev2014-12-09 01:03:45
ASP.NET
Alexey Lebedev, 2014-12-09 01:03:45

How to change 500 error in IIS?

Now I have such a situation:
65a5b4365b51467ca476bd60da7c4e29.png
I want 2 things:
1) to make it just write a server error, without details.
2) make a request response with the code 200 and with information about the error, briefly and in text form. This is for debugging a third party server. debug=true.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoliy Mikhailov, 2014-12-09
@yamaoto

in Web.Config

<customErrors mode="RemoteOnly" defaultRedirect="~/errors/error.aspx">
      <error statusCode="500" redirect="~/errors/error500.aspx"  redirectMode="ResponseRewrite" />/>
    </customErrors>

in the page file
in the backend file of the page
protected void Page_Load(object sender, EventArgs e)
        {
var error = HttpContext.Current.Server.GetLastError();
this.ErrorMessage = error.Message;
        }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question