Question : How to pass a WindowsIdentity object to a web service method?

Hi, I have a web service method which accepts a parameter of type System.Security.Principal.WindowsIdentity.
When I make my web reference from my client project, it creates a namespace for it, and in there a "WindowsIdentity" object. Then when I call the method from the client, it unsuccessfully tries to cast from System.Security.Principal.WindowsIdentity to ServiceReferenceNamespace.WindowsIdentity.

what am I doing wrong here? why is it creating a new class? I'm kind of new to web services, so please bear with me.

Below is my service method:
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
[WebMethod]
        public Content GetContents(string Path, WindowsIdentity authUser)
        {
            FileAttributes attr = File.GetAttributes(Path);
            if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
            {
                //folder
                FileSystemAccessRule rule = GetDirectoryPermissions(authUser, Path);
                if (rule != null && ((rule.FileSystemRights & FileSystemRights.ListDirectory) == FileSystemRights.ListDirectory && rule.AccessControlType == AccessControlType.Allow))
                {
                    return new Content() { DirectoryListing = GetDirectoryContents(Path), IsDirectory = true };
                }
            }
            else
            {
                //file
                FileSystemAccessRule rule = GetFilePermissions(authUser, Path);
                if (rule != null && ((rule.FileSystemRights & FileSystemRights.Read) == FileSystemRights.Read && rule.AccessControlType == AccessControlType.Allow))
                {
                    return new Content() { File = GetFile(Path), IsDirectory = false };
                }
            }
            return null;
        }

Answer : How to pass a WindowsIdentity object to a web service method?

Wells, let's ask first why you need to pass in the WindowsIdentity object into a web method?
Random Solutions  
 
programming4us programming4us