Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Getting an Error page to work with a 401.2 error

Posted on 2012-12-27
Medium Priority
Last Modified: 2012-12-28
I have a website set up that has a web.config in the root directory.  There are also 3 sub directories that each have a web.config that is used for permissions. My problem is that when I try to get the custom errors to work.  I have the following code in the root level web.config.
    <customErrors mode="On" defaultRedirect="Error.htm" />
    <authentication mode="Windows"/>
      <deny users="?" />

Open in new window

I have the following code in one of the sub directories:
<?xml version="1.0"?>
      <allow users="ADS\Smith"/>
      <allow users="ADS\Jones"/>
      <deny users="*"/>
    <customErrors mode="On" defaultRedirect="Error.htm">
      <error statusCode="401" redirect="Admin401.htm" />

Open in new window

 When I receive a general error the Error.htm page works as it should.  What I am trying to get to work is the 401.2 error page. In the subfolder the web.config looks like this:
My 401 error
How do I get the 401.2 error to use my Admin401.htm?
Question by:us1975mc
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Author Comment

ID: 38723734
Forgot to mention that just before I get the 401 error I get the Windows Logon:
Windows Security Logon
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38723774
One answer is here:

Another way to do this is to go into the properties for the site in IIS, and on the Custom Errors tab, change which page is displayed for the 401.2 error.

Author Comment

ID: 38724273
I tried both with no success.  When I entered the code:
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            If Request.IsAuthenticated AndAlso Not String.IsNullOrEmpty(Request.QueryString("ReturnUrl")) Then
            End If
        End If
    End Sub

Open in new window

It does not seem to even see this.  I get the same Sign In:
Sign Inand then I get the same error:
Error 401When I went to the server administrators and they placed the error page on the property for the site in the IIS I received the following error:
Page Error
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 34

Accepted Solution

Paul MacDonald earned 2000 total points
ID: 38724295
Okay, those are two different issues.  You're being asked to log in to the domain (the Windows Security dialog) because you have anonymous access turned off and/or you have permissions set so the web user account (IUSR_whatever) doesn't have permissions to the .aspx page.

The second issue ("the website cannot display the page") could be anything.  Can you try to recreate the problem while viewing the page(s) in IIS?  You should get a more descriptive error message that way.

Author Closing Comment

ID: 38726855
Thanks paulmacd,

It took a little while but it finally came through.

LVL 34

Expert Comment

by:Paul MacDonald
ID: 38726867
Happy to help.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question