Show Custom Error Page While Accessing ASP.NET Site Remotely From Server

Introduction

In this blog, I am going to show you how to show the default error page when accessing  the Asp.net site remotely from the server.

Background

A few days back, I hosted my asp.net application in Windows server 2012 r2 and tried to access it from the remote machine, but surprisingly I got the following error which I didn’t get locally. When I debugged it, I learned some new thing in IIS so I  just thought to share the same with other beginners like me.

Screenshot of the Error

Reason for the Error

When you access the page from server machine (Remote machine) , IIS assumes that you could handle the error by yourself and it won’t show the default error pages to US.

How to resolve this error

Resolving this error will be very easy, you just need to add one line of code in the Web config file as follows:

This tells the IIS that we didn’t handle/provide any custom page for the error, so you could provide the default error pages which are already configured by default like below:

I hope the above information was useful when developers get the error like above for the first time and understand the root cause of the problem.

266 total views, 2 views today

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *