---
title: "Making Custom Error Page in Mvc4"  
description: "In this section I will explain about making of custom error page. We have seen in most of the cases default error page occur. Now we will make our cus"  
author: "Manish Kumar"  
published: 2017-02-18  
updated: 2018-03-17  
canonical: https://www.mindstick.com/blog/11297/making-custom-error-page-in-mvc4  
category: "asp.net"  
tags: ["mvc4"]  
reading_time: 2 minutes  

---

# Making Custom Error Page in Mvc4

In this [section](https://yourviews.mindstick.com/view/297/reservation-for-economically-weaker-section) I will [explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) about making of [custom](https://www.mindstick.com/blog/12298/use-custom-writing-services-to-get-through-the-finals) [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page). We have seen in most of the cases [default](https://www.mindstick.com/interview/12771/what-is-the-importance-of-default-resources) error page occur. Now we will make our custom error. We can [design](https://www.mindstick.com/articles/12279/interior-design-and-furniture-store-wordpress-theme) it according to our need.\

Below are the few steps for [creating our](https://www.mindstick.com/forum/33548/creating-our-own-optional-methods-in-protocol) error page.

First of all add [shared](https://www.mindstick.com/forum/155587/what-is-shared-assembly) folder in the [view](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view) folder

![Making Custom Error Page in Mvc4](https://www.mindstick.com/blogs/4366c045-18f2-4642-b6f6-be16d2a5cc9c/images/95318cb8-980c-4a9e-9c0f-96ef61ddc36f.png)\

**In the shared folder add a view for error view. We can design as want. I had make a simple error page.**

```
@{    Layout = null;} <!DOCTYPE html> <html><head>    <meta name="viewport" content="width=device-width" />    <title>error</title></head><body>    <div>        <h2>Sorry !!! this view is not available</h2>    </div></body></html>
```

## \

**Now add a Home controller and add following code.**

```
using System;using
System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc; namespace
MvcApplication6.Controllers{         public class HomeController : Controller    {        //        // GET: /Home/       [HandleError]        public ActionResult Index()        {                       return View();        }        public ActionResult Add()        {            return View();        }     }} It is set for particular
method we can set it all the method for this do like this. using System;using
System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc; namespace
MvcApplication6.Controllers{     [HandleError]    public class HomeController : Controller    {        //        // GET: /Home/               public ActionResult Index()        {                       return View();        }        public ActionResult Add()        {            return View();        }     }}
```

In the home controller add two method Index() and Add() . HandleError attribute render error page in share folder when error occur and one more important thing is to set customError mode on of web. config root. In System.Web section. There are two web.config in the application in the view folder and in the root .we have to change in the root web.config.

---

Original Source: https://www.mindstick.com/blog/11297/making-custom-error-page-in-mvc4

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
