I'm facing some problems accessing by Claim Based to my web service.
On my App there's only Claim Based: windows auth is disabled and NTLM also. If I access to Sharepoint by web based interface, this recognise me as UserX and everything goes.
If I access by WS there are 2 scenarios:
- Call by UserY (System Account) -> Everything goes well
- Call by UserX (NO SA but SCAdmin) -> Object reference not set to an instance of an object
The code is very simple, gets only current user Login Name:
using (SPSite sito = new SPSite("https://to0wss2k10rey03:50000/sites/Test1"))
{
using (SPWeb web = sito.OpenWeb())
{
string Username = web.CurrentUser.LoginName;
}
}
The exception is raised when i try to get the CurrentUser, wich appears to be null..