Answer the question
In order to leave comments, you need to log in
How to change 500 error in IIS?
Now I have such a situation:
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
in Web.Config
<customErrors mode="RemoteOnly" defaultRedirect="~/errors/error.aspx">
<error statusCode="500" redirect="~/errors/error500.aspx" redirectMode="ResponseRewrite" />/>
</customErrors>
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 questionAsk a Question
731 491 924 answers to any question