In this blog, I am going to show you how to show the default error page when accessing an ASP.NET site remotely from the server.
A few days ago, I hosted my ASP.NET application on 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 my knowledge with other beginners like me.
Screenshot of the Error
Reason for the Error
When you access the page from the server (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 or 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 is useful for when developers get the error like above for the first time and understand the root cause of the problem.