Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SecurityMgr.RegisterUser question w win integration
Message
From
07/05/2008 21:24:13
 
 
To
07/01/2008 01:21:22
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01279847
Message ID:
01315781
Views:
14
Hi Kevin,

As you may recall I was not able to integrate windows userid with the security following the instructions in help doc.

To get it working, I've added a call to AuthenticateUser, below shows where it would be in main.cs, the rest is copied from your 'Integrating with Windows Security' help page. Works for me but I haven't tested all the possible configurations. Without this line, it looked like UserManager.UserID etc. were never getting set, so I could not reference via mmAppBase.UserMgr.UserID later in the application.

FYI.

-Larry
      // Try to get the user record
      oUser.GetUserByIdAndPassword(Name, null);
      if (oUser.DataRow != null)
      {
        // Register the user with the user manager  -ld
           mmAppBase.UserMgr.AuthenticateUser(oUser.DataRow[oUser.UserIDField].ToString(), null,oUser.DatabaseKey);

         // Register the user with the application security manager
         mmAppBase.SecurityMgr.RegisterUser(oUser.DataRow[oUser.PrimaryKey]);
      }
      else
      {
         // Invalid user!!!
      }
>Hi Kevin,
>
>I'm attempting to integrate windows security with mm as per help file. Seems to work okay for gaining access (ie if computer\username not added to userlist it won't let me in), however later in the app I'm unable to obtain current user info using mmAppBase.UserMgr.UserID etc.
>
>This works when I use the logon screen, just not the integration as per the code below, which was copied from the help file instructions. The DataRow does get populated with the correct userid and passed into RegisterUser.
>
>Have I missed a step somewhere?
>
>Suggestions?
>
>
>thanks,
>
>-Larry
>
>
>-----
>(from main.cs)
>
>String Name = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
>
>// Get a reference to the User object
>OakLeaf.MM.Main.Security.mmUser oUser = mmAppBase.SecurityMgr.oUser;
>
>// Try to get the user record
>oUser.GetUserByIdAndPassword(Name, null);
>if (oUser.DataRow != null)
> {
> // Register the user with the application security manager
> mmAppBase.SecurityMgr.RegisterUser(oUser.DataRow[oUser.PrimaryKey]);
> result = DialogResult.OK;
> }
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform