IIS 7.5 can't access file from managed code
        Posted  
        
            by Bob
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Bob
        
        
        
        Published on 2010-04-07T18:20:40Z
        Indexed on 
            2010/04/07
            18:23 UTC
        
        
        Read the original article
        Hit count: 400
        
I am working on a project that is click-once deployed from an IIS 7.5 web server.  After installing the parent application (i.e. setting up the IIS site) I am able to hit the url for the click-once app's config file from a remote box.
HOWEVER, when I attempt to do the same thing from my app (and the stub app below), I get a 401 Unauthorized.
What is the difference between hitting the URL from IE, and from a .NET app?
The file and directory itself have full control granted to everyone on the webserver at the moment, and I am an admin on the box.  We are using Windows Authentication with NTLM only.
Thanks, -Bob
Here is the stub app that produces the 401 - Unauthorized when on the doc.Load() line. I can hit the same URL successfully from IE and open the file...
static void Main(string[] args)
    {
        Console.WriteLine("Config Test");
        string filename = "http://dev-rs/myClient/myClickOnce/myApp.config.xml";
        Console.WriteLine(filename);
        XmlDocument doc = new XmlDocument();
        doc.Load(filename);
        Console.WriteLine("Loaded");
        Console.WriteLine("Inner Text : " + doc.InnerText);
    }
        © Stack Overflow or respective owner