I am launching a webpage which should be able to read the login ID of the current user. Here is the code I'm using:
string id = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
This currently returns the correct login, but when I use it in this method:
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;
}
The method returns false, even if the returned identifier is identical to pageOwnerID. I'm really not sure which part of this I have a problem in.
On a side note, my login ID is of the form string1 / string2, but the code returns it as string1 + string2 without a slash.
Any advice is appreciated.
Sincerely.
Kevin source
share