現在のユーザーのログインIDを読み取れるようにする必要があるWebページを実行しています。これが私が使用しているコードです:
string id = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
現在、これは正しいログインを返しますが、このメソッドで使用すると:
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;
}
返されるIDがpageOwnerIDと同じであっても、メソッドはfalseを返します。私はこれのどの部分に問題があるのか本当にわかりません。
ちなみに、私のログインIDはstring1 / string2の形式ですが、コードはスラッシュなしでstring1+string2として取得します。
アドバイスをいただければ幸いです。
よろしく。