Solved

HTTP 401.1 - Unauthorized: Logon Failed - ASP.NET IIS problem

Posted on 2006-12-01
8
3,822 Views
Last Modified: 2008-01-09
Hi  Experts

Developing ASP.NET 2.0 app that works fine at work and did work fine when I copied it to my home PC.  

But now it still works fine at work but when I copied the files back on my home PC and run the app I get a login screen which I don't get at my work PC.  Then I get the errror "HTTP 401.1 - Unauthorized: Logon Failed"  any advice appreciated.


0
Comment
Question by:mugsey
  • 5
  • 3
8 Comments
 
LVL 11

Expert Comment

by:ethoths
ID: 18053595
Looks like it's using Windows authentication and since your authenticated at your work machine (on your network) it passing. Send your Web.Config file.

0
 

Author Comment

by:mugsey
ID: 18053605
Thanks ethoths

Here is my web.config...................

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
      <configSections>
            <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
            <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
      </configSections>
      <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
            <listeners>
                  <add fileName="DSItrace.log" header="DSI Logging ---------------------------------------- DSI Logging" footer="DSI Logging ---------------------------------------- DSI Logging" formatter="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="FlatFile TraceListener"/>
            </listeners>
            <formatters>
                  <add template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Title:{title}
Machine: {machine}
Application Domain: {appDomain}
Process Id: {processId}
Process Name: {processName}
Win32 Thread Id: {win32ThreadId}
Thread Name: {threadName}
Extended Properties: {dictionary({key} - {value}
)}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Text Formatter"/>
            </formatters>
            <categorySources>
                  <add switchValue="All" name="General">
                        <listeners>
                              <add name="FlatFile TraceListener"/>
                        </listeners>
                  </add>
            </categorySources>
            <specialSources>
                  <allEvents switchValue="All" name="All Events"/>
                  <notProcessed switchValue="All" name="Unprocessed Category"/>
                  <errors switchValue="All" name="Logging Errors &amp; Warnings">
                        <listeners>
                              <add name="FlatFile TraceListener"/>
                        </listeners>
                  </errors>
            </specialSources>
      </loggingConfiguration>
      <exceptionHandling>
            <exceptionPolicies>
                  <add name="DSILog">
                        <exceptionTypes>
                              <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">
                                    <exceptionHandlers>
                                          <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Logging Handler"/>
                                    </exceptionHandlers>
                              </add>
                        </exceptionTypes>
                  </add>
            </exceptionPolicies>
      </exceptionHandling>
      <appSettings>
            <add key="NominatedEmail" value="eugene.cook@liverpooldirectlimited.co.uk"/>
            <add key="FromEmail" value="eugene.cook@liverpooldirectlimited.co.uk"/>
      </appSettings>
      <!-- email settings -->
      <system.net>
            <mailSettings>
                  <smtp>
                        <network host="itsnt440.liverpool.gov.uk"/>
                  </smtp>
            </mailSettings>
      </system.net>
      <system.web>
            <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
            <compilation debug="true">
                  <assemblies>
                        <add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                        <add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                        <add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
            </compilation>
            <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
            <authentication mode="Windows"/>
            <authorization>
                  <deny users="?"/>
            </authorization>
            <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.
    -->
            <customErrors mode="On" defaultRedirect="_webForms/GenericError.aspx">
                  <error statusCode="403" redirect="NoAccess.htm"/>
                  <error statusCode="404" redirect="FileNotFound.htm"/>
            </customErrors>
            <pages theme="DSI"/>
            <!-- get the current user-->
            <profile>
                  <properties>
                        <add name="UserName"/>
                  </properties>
            </profile>
      </system.web>
</configuration>
0
 

Author Comment

by:mugsey
ID: 18053730
If I navigate to localhost I still get the same login prompt
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 11

Accepted Solution

by:
ethoths earned 500 total points
ID: 18053774
This is  your problem...

 <authentication mode="Windows"/>
          <authorization>
               <deny users="?"/>
          </authorization>

Basically thi si ssaying deny access to anybody who is not Windows authenticated.

What are the security requirements for your site?



0
 

Author Comment

by:mugsey
ID: 18053792
But even if I set authenticatio mode to "None" I still get the login prompt.  I can run other asp.net apps fine its just this one.  Even if I navigate to http://localhost/ I still get the login prompt.  

I will be using my own security via a database table but I also need to trap users logged in NT username.
0
 
LVL 11

Expert Comment

by:ethoths
ID: 18053811
Check you anomynous access setting in IIS.

0
 

Author Comment

by:mugsey
ID: 18053821
Yep I have done this also - really strange.
0
 

Author Comment

by:mugsey
ID: 18053879
Dohhh!

You were right ethos - I removed the deny users section and it works fine

<authentication mode="Windows"/>
            <!--<authorization>
                  <deny users="?"/>
            </authorization> -->

Thanks
0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSL Certificate for IIS7 Site 2 96
How to make a good PHP + MySQL + JS pagination system? 3 65
TLS 1.0 & Windows 7 - How to disable? 16 111
FTP security 1 28
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

713 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