Solved

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

Posted on 2006-12-01
8
3,802 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

744 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

13 Experts available now in Live!

Get 1:1 Help Now