Over a million developers have joined DZone.

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

How to resolve a weird server error with ASP.NET on Windows Server 2012.

· Web Dev Zone

Make the transition to Node.js if you are a Java, PHP, Rails or .NET developer with these resources to help jumpstart your Node.js knowledge plus pick up some development tips.  Brought to you in partnership with IBM.

Introduction

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.

Background

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.

Learn why developers are gravitating towards Node and its ability to retain and leverage the skills of JavaScript developers and the ability to deliver projects faster than other languages can.  Brought to you in partnership with IBM.

Topics:
iis

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}