开发者

How do I get an anonymous user object from SharePoint 2010

开发者 https://www.devze.com 2023-01-04 11:04 出处:网络
I have a site setup using Claims Based (Forms) authentication with Anonymous access enabled. When a user logs into the site they may exist in the Forms Database, but not in the SharePoint Site collec

I have a site setup using Claims Based (Forms) authentication with Anonymous access enabled.

When a user logs into the site they may exist in the Forms Database, but not in the SharePoint Site collection. In this case SPContext.Current.Web.SPUser returns NULL -开发者_如何学C even though they are logged in.

Is there another object similar to SPUser that I can use?


Is HttpContext.Current.User.Identity.IsAuthenticated == true? If so, try putting a call to SPContext.Current.Web.EnsureUser(HttpContext.Current.User.Identity.Name) before digging into Web.CurrentUser (which is what I presume you meant, not Web.SPUser)

-Oisin

0

精彩评论

暂无评论...
验证码 换一张
取 消