---
title: "Configure Custom Error Messages in ASP.NET in Cloud Sites"
source: "https://docs.nexcess.com/hosting/cloud-sites/asp-net-and-iis/configure-custom-error-messages-in-asp-net-in-cloud-sites/"
description: "You can enable custom error messages for your ASP.NET application on Windows IIS by using a web.config file with a customErrors setting configured."
vertical: "Hosting"
date: "2024-03-04"
last_modified: "2026-07-21"
---

# Configure Custom Error Messages in ASP.NET in Cloud Sites

| ### **Note:** |
|---|
| The script provided below is only an example. As outlined in our [Terms of Service](https://www.liquidweb.com/policies/terms-of-service/) and our article [Management and Support Levels](https://docs.nexcess.com/hosting/portal/support-center/management-and-support-levels/), we are unable to help you troubleshoot code and script issues. We recommend speaking with your developer before implementing any script functionality. |

You can enable custom error messages for your [ASP.NET](https://www.liquidweb.com/vps-hosting/asp-net/) application on Windows IIS by using a web.config file with a customErrors setting configured.

| ### **Warning:** |
|---|
| For security purposes and coding best practices, set the customErrors mode to **RemoteOnly** or **On** instead of Off. The Off mode is primarily useful for debugging, and it should not be used in a production environment because of the details that it can expose about your server. |

To configure a custom error page for ASP.NET 3.5 SP1 and later, follow this example:

```
<configuration>
   <system.web>
      <customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/error.aspx" />

   </system.web>
</configuration>
The following example is for ASP.NET 2.0 to 3.5 without SP1:

<configuration>
  <system.web>
      <customErrors mode="On" defaultRedirect="~/error.html" />

  </system.web>
</configuration>
```
