---
title: "Configure ASP.NET Custom Error Messages in Cloud Sites"
source: "https://docs.nexcess.com/hosting/cloud-sites/asp-net-and-iis/configure-asp-net-custom-error-messages-in-cloud-sites/"
description: "Learn how to configure ASP.NET custom error messages on Nexcess Cloud Sites. Discover how to replace default IIS errors to improve user experience."
vertical: "Hosting"
date: "2024-03-04"
last_modified: "2026-11-13"
---

# Configure ASP.NET Custom Error Messages in Cloud Sites

## Introduction

 Use at your own risk

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 [Support Scope](https://docs.nexcess.com/hosting/portal/support-center/management-and-support-levels/scope-of-support-cloud-sites/), 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.

 For production environments

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.

 

---

## Prerequisites

- An active Cloud Sites account
- An ASP.NET 3.5 SP1 or later based application.

---

## Code 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>

```
