开发者

SharePoint session persist across several users?

I have a custom web part that starts by getting a current user login name like this:

protected static string iAm = System.Web.HttpContext.Current.Request.ServerVariables["AUTH_USER"].Split("\\".ToCharArray())[1].ToLower(). 

Then it passes this string to a bbl class and fetches a user id:

`IDataReader _drInfo = cisf_BLL.bll_MyInfo.drGetMyInfo(iAm);
while (_drInfo.Read())
{
  iUser_Ident = _drInfo.GetInt32(30);
}

`After that it passes th开发者_如何学JAVAe user id integer to another method that fetches user's training record:

_drUserTraining = bll_Training.drGet_required_training_records(iUser_Ident);
            _drUserTrainingCompleted = bll_Training.drGet_completed_training_records(iUser_Ident);

This information is then displayed in a tab container with three tab such as "Overdue", "Required", and "Completed".

The problem I'm having is this: I'm logged into SharePoint collaboration site with my domain user name and all my training is displayed just fine. If my someone else then logs in to the SP Portal that user sees my training and not his, even though this user has logged in with his unique credential using a common access card, just as I.

Somehow some strange session seems to persist and I was hoping someone out here has encountered this anomaly.

Thanks in advance!

Risho


You are misusing static - a static property is stored once per web server process, not once per user.


Not an answer, but code improvement: there is much simplyer way to get current user name/id

SPUser user = Microsoft.SharePoint.[SPContext][1].Current.Web.CurrentUser;
user.ID;
user.Email;
user.Name
user.LoginName;
user.Grups;
....

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spuser_members.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜