﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WebForms (How do I?)  » Problems Setting Logged In User</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Fri, 11 Sep 2026 15:28:30 GMT</lastBuildDate><ttl>20</ttl><item><title>Problems Setting Logged In User</title><link>http://forum.strataframe.net/FindPost7028.aspx</link><description>I am trying to implement StrataFrame role based security in one of our ASP.NET applications (It's not a StrataFrame App).&amp;nbsp; I have tried to follow the docs on this and I think I am pretty close, but I seems to have a problem setting the current user, and thus I am having problems extracting the correct permissions.&lt;/P&gt;&lt;P&gt;Here is what I have done so far.&lt;/P&gt;&lt;P&gt;1) Added the appropriate references and imports&lt;/P&gt;&lt;P&gt;2) In the application_start, I added SecurityBasics.IsWebEnvironment = True&lt;/P&gt;&lt;P&gt;3) Added the connection for the security database&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataLayer.DataSources.Add("SECURITY",Connection String)&lt;/P&gt;&lt;P&gt;4) Set the security datasource key&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SecurityBasics.SecurityDataSourceKey = "SECURITY"&lt;/P&gt;&lt;P&gt;5) Set the current logged in user&amp;nbsp; (using user1 as test and does exist in the db)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim loResult as Login.LoginResult&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; loResult = Login.SetLoggedInUser("user1","password",''")&lt;/P&gt;&lt;P&gt;&amp;nbsp;The result of the login is 'success' but when I check the SecurityBasics.CurrentUser.UserName, I get "Administrator", which is causing me a problem when I check the currentUser.getPermission.&lt;/P&gt;&lt;P&gt;Did I miss something?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Tim</description><pubDate>Wed, 21 Feb 2007 13:21:55 GMT</pubDate><dc:creator>Tim Dol</dc:creator></item><item><title>RE: Problems Setting Logged In User</title><link>http://forum.strataframe.net/FindPost7078.aspx</link><description>I tried that Ben and it didn't seem to work.&amp;nbsp; I sent you an email with a bunch of screen shots to show you what is happening. Perhaps this will help.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Tim</description><pubDate>Wed, 21 Feb 2007 13:21:55 GMT</pubDate><dc:creator>Tim Dol</dc:creator></item><item><title>RE: Problems Setting Logged In User</title><link>http://forum.strataframe.net/FindPost7076.aspx</link><description>The AuthenticateUser method does not actually change the CurrentUser object... it only authenticates the user and populates the SFSUsersBO object with the data for the user (if he/she authenticated i.e. the method returned Success).&amp;nbsp; You then take the exact same business object and pass it to the SetLoggedInUser() method (just like you have above) and it changes the SecurityBasics.CurrentUser object.&amp;nbsp; So, the username property won't reflect the new user until you call the SetLoggedInUser() method.</description><pubDate>Wed, 21 Feb 2007 11:47:26 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Problems Setting Logged In User</title><link>http://forum.strataframe.net/FindPost7057.aspx</link><description>&lt;FONT color=#3333dd&gt;I tired a number of different ways and the end result was the same in each case.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;First I tried:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#008000 size=2&gt;&lt;P&gt;&lt;FONT color=#dd3333&gt;Dim loResult As MicroFour.StrataFrame.Security.Login.LoginResult&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#dd3333 size=2&gt;loResult = MicroFour.StrataFrame.Security.Login.SetLoggedInUser(loUserName, loPassword, "")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd size=2&gt;The return value in loResult = Success, but when I checked CurrentUser.UserName, it returned 'Administrator'.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd size=2&gt;So then I looked at the source code for&amp;nbsp;SetLoggedInUser function and then tried the following code.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;&lt;FONT color=#dd3333&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#dd3333&gt;&lt;FONT size=2&gt; loUserInfo &lt;/FONT&gt;&lt;FONT size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; SFSUsersBO = &lt;/FONT&gt;&lt;FONT size=2&gt;Nothing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#dd3333&gt;&lt;FONT size=2&gt;Dim&lt;/FONT&gt;&lt;FONT size=2&gt; loResult &lt;/FONT&gt;&lt;FONT size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#dd3333&gt; MicroFour.StrataFrame.Security.Login.LoginResult&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#dd3333&gt;'-- Authenticate the user&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;FONT color=#dd3333&gt;loResult = MicroFour.StrataFrame.Security.Login.AuthenticateUser(loUserName, loPassword, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#dd3333 size=2&gt;""&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#dd3333&gt;, loUserInfo)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#dd3333&gt;LoggedInUser.SetLoggedOnUser(loUserInfo)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;I believe SetLoggedOnUser executes same code you mentioned in your reply. When I checked variable loUserInfo,&amp;nbsp;after the AuthenticateUser, the user information was correct, but after executing the SetLoggedOnUser, the CurrentUser.Username was 'Administrator'.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;I hope I can get this resolved because I committed to implementing the StrataFrame role based security in this web project so I can scrap the existing security model.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;Is there something else I can check?&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#3333dd&gt;&lt;P&gt;&lt;BR&gt;Thanks&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Wed, 21 Feb 2007 09:58:13 GMT</pubDate><dc:creator>Tim Dol</dc:creator></item><item><title>RE: Problems Setting Logged In User</title><link>http://forum.strataframe.net/FindPost7050.aspx</link><description>You can create a new logged in user by using the following command:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;[codesnippet]CurrentUser = MicroFour.StrataFrame.Security.LoggedInUser.CreateNew(MySFSUsersBO)[/codesnippet]&lt;/P&gt;&lt;P&gt;Is this what you are trying to get to?&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Wed, 21 Feb 2007 09:35:51 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>