Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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

DZone's Guide to

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
Free Resource

Prove impact and reduce risk when rolling out new features. Optimizely Full Stack helps you experiment in any application.

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.

With SDKs for all major client and server side platforms, you can experiment on any platform with Optimizely Full Stack.

Topics:
iis

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}