Solved

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

Posted on 2006-12-01
8
3,809 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

#SSL #TLS #Citrix #HTTPS #PKI #Compliance #Certificate #Encryption #StoreFront #Web Interface #Citrix XenApp
Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now