Accessing mapped folder from a Windows Service written in C#
<p>I have a windows service which polls for a specific folder for creation of new files. This works fine when the folder is in one of the local drives such as C: or D:
The service fails to find a folder on a mapped drive.</p>

<p>Here is the code which does the checking for folder exist before polling:</p>

<pre><code>System.Security.Principal.WindowsIdentity userIdentity =
            System.Security.Principal.WindowsIdentity.GetCurrent();
            System.Security.Principal.WindowsPrincipal principal =
                new System.Security.Principal.WindowsPrincipal(userIdentity);

            MappedDriveResolver mdr = new MappedDriveResolver();
            if (mdr.isNetworkDrive(folderPath))
            {
                LoggingAppWrapper.LogDeveloperMessage(folderPath + " is on a Mapped    drive", 1, TraceEventType.Information, string.Empty);

            }
</code></pre>

<p>MappedDriveResolver is a class that I found here<a href="http://stackoverflow.com/questions/2067075/how-do-i-determine-a-mapped-drives-actual-path">How do I determine a mapped drive's actual path?</a></p>

<p>The code in that link works fine from a simple console application, but fails when it is part of windows service.
Any suggestions as to what has to be done for the code to work for a windows service?</p>

<p>Regards.</p>
