Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7636129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:35:41+00:00 2026-05-31T07:35:41+00:00

We are converting some of our web applications that used to run under forms

  • 0

We are converting some of our web applications that used to run under forms authentication, to now run as windows authentication. I want to recreate the page security that forms authentication had with minimum modification to the actual pages. I was able to recreate the effect I want, with a simplified web app. I am running the app on Server 2008 R2 integrated pipeline IIS 7.5.

I created a simple 3 page app using windows authentication. The three pages are:

  • Openpage.aspx, that is open to any authenticated user
  • Blockedpage.aspx that is blocked to all users (symbolic of a directory or page that would be blocked to a subset of users based on user role)
  • ErrorPage.aspx,if blockedpage.aspx is accessed (and rejected) the application should forward to ErrorPage.aspx where the user gets generic information about the application.

The Web.Config for the app:

<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
      <authentication mode="Windows"/>
      <authorization>
        <deny users="?" />
        <allow users="*" />
      </authorization>
    </system.web>
  <location path="blockedpage.aspx">
    <system.web>
      <authorization>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
  <system.webServer>
   <httpErrors errorMode="Custom" >
      <remove statusCode="401" subStatusCode="-1" />
      <error statusCode="401" path="/development/simplesecurityapp/errorpage.aspx" responseMode="ExecuteURL" />
    </httpErrors>

    <validation validateIntegratedModeConfiguration="false" />
    <defaultDocument>
      <files>
        <clear />
        <add value="openpage.aspx" />
      </files>
    </defaultDocument>
  </system.webServer>

</configuration>

(If I don’t attempt to redirect the 401 errors at the asp.net level, I just get the standard “not authorized message” which is not the effect I want to give my users.)

However, I am getting an error that I don’t understand – every time the server resets, the app stops working. IIS simply returns 401 errors until the browser pops up a manual log-in control, which cannot be satisfied. (I never want my users to be presented with the browser log-in prompt)

However, if I replace the httperrors section once the application is set up (either by editing the web config, or updating it with the server GUI) removing the section, accessing the page, and then adding the section back, the application starts to work as expected, and continues to until the server is rebooted, at which time it starts giving users the manual login pop-up again, which they cannot resolve.

1) Is this the correct way to secure an app with windows authentication (is there a better way to configure a directory inaccessible like in forms, yet still supply a custom error page?)

2) Is this an effect of the integrated pipeline and why is it working this way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:35:43+00:00Added an answer on May 31, 2026 at 7:35 am

    You’re trying to provide content over a transport error message.

    Forms allows you to do this because it’s composed of layer 7 stuff, like 302s and 200s. 401s are interpreted by the client browser as “the server didn’t like my credentials, so raise a dialog box to ask for new ones”.

    An authenticated page produces at least 1 401 in order to become authenticated; that you’re overloading the “error” for something else is probably the root of the problem.

    I’m not sure there’s an elegant way of doing what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been converting some .net Web Sites to Web Applications. This has been going
I am in the process of converting some of our web services to MVC3
I'm doing some converting of wav-files to mp3 and I use lame.exe. Now, when
We're in the process of converting web app to IE8 (now client is using
I'm working on converting an old C program (currently run on UNIX) into our
I'm looking at converting some of our complex creation code to use an IoC
We are in the process of converting a batch job that processes our bounced
I am converting some Java code to C#. This code is using getGlyphOutline from
I'm converting some services from Apache SOAP to Axis2, so the Java service classes
I am planning on converting some longitude and latitude values to XML and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.