RE: ASP.Net app cannot read XML with Anonymous Authentication disabled
From: Patrick C. Cole (patcole@online.microsoft.com)
Date: 11/04/02
- Next message: Ian Hellen [MS]: "Re: Smartcard Encryption under Windows"
- Previous message: David P. Donahue: "Security Error Message"
- In reply to: Daniel Dinucci: "ASP.Net app cannot read XML with Anonymous Authentication disabled"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: patcole@online.microsoft.com (Patrick C. Cole (MS)) Date: Mon, 04 Nov 2002 20:57:34 GMT
Dan,
One possible solution would be to allow impersonation for the application,
and then grant read/write access to the account you specifiy for use with
impersonation.
For more information on setting this up, take a look at the following
article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/ht
ml/gngrfidentitysection.asp
Let me know if this helps. If not, I will be happy to look into this
further for you.
Patrick Cole
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved.
--------------------
| From: "Daniel Dinucci" <djd@dolby.com>
| Subject: ASP.Net app cannot read XML with Anonymous Authentication
disabled
| Date: Thu, 31 Oct 2002 10:36:05 -0800
| Lines: 167
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
| Message-ID: <#Ts3uwQgCHA.3752@tkmsftngp08>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.security
| NNTP-Posting-Host: 12.96.129.254
| Path: cpmsftngxa09!cpmsftngxa06!tkmsftngp01!tkmsftngp08
| Xref: cpmsftngxa09 microsoft.public.dotnet.framework.aspnet.security:2803
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
|
| I've been working on a simple ASP.Net application. The app reads a couple
of
| real simple XML files from it's local directory. The problem I'm having is
| that the application will not read these files when I disable Allow
| Anonymous Access to the site. It throws an unauthorized error (below).
I've
| tried applying the local ASPNET user to the folder permissions list with
no
| luck.
|
| Since disabling Allow Anonymous Access is a requirement and so is reading
| these xml files, would you know of a solution to this problem or
somewhere I
| can go look.
|
| Thanks in advance for your expertise.
|
| ~Dan
|
| More details:
|
| Here is the code excerpt
|
| Dim reader As XmlReader = Nothing
|
| Dim ProjReader As XmlReader = Nothing
|
| Dim RoomURL As String = Session("RoomListURL")
|
| Dim ProjURL As String = Session("ProjectorListURL")
|
| Dim RedirectURL As String
|
| Try
|
| 'Get XML Data for Rooms and load in Room dropdown
|
| reader = New XmlTextReader(RoomURL)
|
| Location.Items.Add("Select Location")
|
| While (reader.Read())
|
| If reader.NodeType = XmlNodeType.Element And reader.Name = "room" Then
| Location.Items.Add(reader.ReadString.ToString)
|
| End While
|
| 'Get XML Data for Projector and load in Projector Dropdown
|
| ProjReader = New XmlTextReader(ProjURL)
|
| LCDProjector.Items.Add("Select Projector")
|
| While (ProjReader.Read())
|
| If ProjReader.NodeType = XmlNodeType.Element And ProjReader.Name =
| "projector" Then LCDProjector.Items.Add(ProjReader.ReadString.ToString)
|
| End While
|
| Catch ex As Exception
|
| RedirectURL = "Fail.aspx?msg=Problem Loading Drop Downs."
|
| Response.Redirect(RedirectURL)
|
| Finally
|
| If Not reader Is Nothing Then
|
| reader.Close()
|
| End If
|
| If Not ProjReader Is Nothing Then
|
| ProjReader.Close()
|
| End If
|
| End Try
|
|
|
| Here is the error it throws:
|
| Server Error in '/EventPlanning' Application.
|
| The remote server returned an error: (401) Unauthorized.
|
| Description: An unhandled exception occurred during the execution of the
| current web request. Please review the stack trace for more information
| about the error and where it originated in the code.
|
| Exception Details: System.Net.WebException: The remote server returned an
| error: (401) Unauthorized.
|
| Source Error:
|
|
| Line 291: reader = New XmlTextReader(RoomURL)
|
| Line 292: Location.Items.Add("Select Location")
|
| Line 293: While (reader.Read())
|
| Line 294: If reader.NodeType = XmlNodeType.Element And reader.Name =
| "room" Then Location.Items.Add(reader.ReadString.ToString)
|
| Line 295: End While
|
|
|
| Source File: c:\inetpub\wwwroot\EventPlanning\AddEvent.aspx.vb Line: 293
|
| Stack Trace:
|
|
| [WebException: The remote server returned an error: (401)
| Unauthorized.]
|
| System.Net.HttpWebRequest.CheckFinalStatus()
|
| System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
|
| System.Net.HttpWebRequest.GetResponse()
|
| System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials
| credentials)
|
| System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
| credentials) +94
|
| System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role,
Type
| ofObjectToReturn) +55
|
| System.Xml.XmlTextReader.CreateScanner() +170
|
| System.Xml.XmlTextReader.Init() +23
|
| System.Xml.XmlTextReader.Read() +530
|
| EventPlanning.WebForm2.LoadDropdowns() in
| c:\inetpub\wwwroot\EventPlanning\AddEvent.aspx.vb:293
|
| EventPlanning.WebForm2.Page_Load(Object sender, EventArgs e) in
| c:\inetpub\wwwroot\EventPlanning\AddEvent.aspx.vb:100
|
| System.Web.UI.Control.OnLoad(EventArgs e) +67
|
| System.Web.UI.Control.LoadRecursive() +29
|
| System.Web.UI.Page.ProcessRequestMain() +724
|
|
|
|
| Version Information: Microsoft .NET Framework Version:1.0.3705.209;
ASP.NET
| Version:1.0.3705.0
|
|
|
|
|
|
|
|
|
|
|
|
- Next message: Ian Hellen [MS]: "Re: Smartcard Encryption under Windows"
- Previous message: David P. Donahue: "Security Error Message"
- In reply to: Daniel Dinucci: "ASP.Net app cannot read XML with Anonymous Authentication disabled"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|