Getting The Current User Name In ASP.NET Application
<p>I am running a webpage that needs to be able to read the login id of the current user.  Here is the code I am using:</p>

<pre><code>string id = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
</code></pre>

<p>Currently this returns the correct login but when I use it in this method:</p>

<pre><code>protected Boolean isPageOwner()
{
    string id = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
    alert("User: " + id);
    if (id.Equals(pageOwnerID))
    {
        return true;
    }
    if (accessPermission.ContainsKey(id))
    {
        return true;
    }
    return false;
}
</code></pre>

<p>the method returns false even though the id returned is identical to pageOwnerID.  I'm really not sure which part of this I am having a problem with.</p>

<p>On a side note, my login id is of the form string1/string2 but the code retrieves it as string1 + string2 without the slash.</p>

<p>Any advice is appreciated.</p>

<p>Regards.</p>
