开发者

HttpContext.Current.User.Identity.User.Name is blank on MySite creation in SharePoint

We have a sharepoint feature which gets activated on 'MySite' creation. We need to get the logged in user'开发者_如何转开发s active directory user name in that feature...So we have used HttpContext.Current.User.Identity.User.Name but it throws following exception "System.ArgumentException: Account name cannot be an empty string."

Any idea why is it blank ? Or is there some other way where we can get logged in user's AD user name ??

Appreciate any help.


Try SPContext.Current.Web.CurrentUser.LoginName


I am not sure about "Mysite". However in general you need to have "Integrated windows Authentication" selected. You may reach to this option via

IIS->website->properties->Directory Security->Authentication and Access control -> Edit

Also if have your web.config you should have authentication mode as "windows".

If it is not helpful post more info about the "feature", how it is coded? where is is published?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜