Running Unmanaged code LogonUser() on a UNC Path

From: Chris Crowe (chris.crowe@trimble.co.nz)
Date: 01/22/03


From: "Chris Crowe" <chris.crowe@trimble.co.nz>
Date: Wed, 22 Jan 2003 17:20:30 +1300


I have a problem running unmannaged code and I can not find the answer to
it.

I have created an assembly that hooks into the HTTP handlers section of
Web.CONFIG

This assembly uses the LogonUser windows API (Unmanaged Code) for
authentication and I get back an error 5. Access Denied.

The assembly is actually located on a file server and not on the local
machine.

The web site runs under Local Intranet (displayed in IE) - the web app is
for a intranet.

In .NET Framework configuration Runtime Security Policy I have given the
file share under MACHINE\Code Groups\All_Code\LocalIntranet_Zone full rights
for the url:

file://NZ01FSV03/SOURCE/is/dba/*

This stops VS.NET complaining but how do I get it to run on the web server?.
I do not want to have this assembly local since it requires copying all the
time when I compile. On the web server the rest of the web application
(which is on the File Server) runs fine but the LogonUser API fails with
Error 5.

What context do I need to configure for this? Am I in the right area being
in the Runtime Security Policy section of .NET Framework configuration?

If I use the Evaluate Assembly wizard at "Runtime Security Policy" in ".Net
Framework Configuration" my assembly with the LogonUser API call in it shows
as "unrestricted"

Under List Of Code Groups in the wizard there is this:

Enterprise Policy
  All_Code
Machine Policy
  All_Code
    Local_IntranetZone
      Intranet_Same_Site_Access
      Intranet_Same_Directory_Access
      (my code policy which gives full control)
User Policy
  Policy level not evaluated.

Has anyone got any ideas here?

Chris