Hi;
Note: While our specific use is ASP.NET, this is a general "accessing XML" question.
Our ASP.NET application allows a user to give it an XML filename and the app then opens that file as a datasource to generate a report. The issue we face is we do not want the file opened using the credentials of the user that our ASP.NET app is running under for two reasons:
- The ASP.NET user may not have access to \\hr\payroll\salaries.xml but the person requesting the report does.
- The ASP.NET does have access to Web.Config but the person requesting the report does not.
Our app supports both forms and WindowsIdentity as an authtication/authorization method. So we do not have the client identity to use if they are using the forms system.
For http(s) and ftp this is a piece of cake - we create a NetworkCredential and pass that to the Resolver for XmlDocument when doing it's load. Problem solved there.
But how do we handle files that are local to the server, on a network drive on the server, or on a \\server\share accessable from the server And in all of those cases, the username/password to access the file could be a domain user or could be a user that exists only on the local machine - and that machine is remote from the ASP.NET server. Or it could be a user on another domain and that domain does not have a trust relationship with the domain our app is running on. Or the file could be available to "Everyone" which means with no credentials it can be read.
And with the way our system is structured, whatever file/credentials are setup, there will be multiple simultaneous requests to access the same data using the same credentials. So we cannot use the NetUseAdd call because it will fail if a connaction to that \\server\share already exists.
We can handle the case where it is a domain user on our domain used to access the file using impersonation. But the other cases appear to have no solution.
Help!!!!!
thanks - dave

Accessing XML files via network shares
ChrisMoje
Ok, I'll try there. I tried here first in case XML had some method like the Resolver for http and ftp access.
thanks - dave
smc750
If it's file access question than it means that it could be minimized down to system.IO then the question could go to:
http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=39&SiteID=1
WolframW
Please ask this question at ASP.NET forums http://forums.asp.net/.
Best regards,
Anton
Fabio Pagano
Hi;
I know that. The problem is how do I login as a given user on a foregin domain - that's the problem.
thanks - dave
zapacila89
Hi Dave,
You may subclass XmlUrlResolver or XmlResolver and implement any logic you wish in the overriden ResolveUri() and GetEntity() methods. So if you know how to access the files in question from C# code, it should be easy to put this logic into a custom XmlResolver implementation.
Hope it helps,
Anton
soanfu
Frame
wolfsch
The ASP.NET group (and I agree with them) said this is not ASP.NET specific but instead is really a file access question.
thanks - dave