Unable To Get User Authenticated Using Web Form


Author
Message
Jeff Pagley
Jeff Pagley
StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
First of all I read the help and it instructed me to add the following line to Global.asax file:

SecurityBasics.IsWebEnvironment = true;

Then using the code copied from the help files (see below) I try to authicate the user.  However, the login fails.  I know this code and username and password works, because I used the exact same code from a Windows form.  When looking at the user name returned by SecurityBasics.CurrentUser after the authentication fails, it is 'Administrator' even though I am trying to authenticate another user.  What is wrong or what do I have to do to get this same code to work from a Web form? 

//-- Establish locals

StringBuilder sb = new StringBuilder();

String userName = "";

MicroFour.StrataFrame.Security.
Login.LoginResult loResult;

//-- Attempt to authenticate the user

loResult = MicroFour.StrataFrame.Security.Login.SetLoggedInUser(this.txtUsername.Text, this.txtPassword.Text, "");

//-- If the result if Success, AdminLoggedOn, or SecMaintUserLoggedOn, the

// SecurityBasics.CurrentUser object will be changed to the correct user

//-- Do something based upon the result

switch (loResult)

{

case MicroFour.StrataFrame.Security.Login.LoginResult.Success:

sb.AppendLine(
"Login successful.");

userName = MicroFour.StrataFrame.Security.
SecurityBasics.CurrentUser.UserName;

sb.AppendLine(userName);

this.lblMessage.Text = sb.ToString();

return true;

case MicroFour.StrataFrame.Security.Login.LoginResult.Failure:

this.lblMessage.Text = "Login failed.";

return false;

case MicroFour.StrataFrame.Security.Login.LoginResult.UserDeactivated:

this.lblMessage.Text = "User Deactivated.";

return true;

default:

this.lblMessage.Text = "Unexpected Error: No login result returned.";

return false;

}

}

 


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Jeff Pagley - 14 Years Ago
Jeff Pagley - 14 Years Ago
Trent L. Taylor - 14 Years Ago
Jeff Pagley - 14 Years Ago
                     First, I noticed that you are still talking straight to the...
Trent L. Taylor - 14 Years Ago
                         Hi Trent, You are right about talking staight to Strataframe. I do...
Jeff Pagley - 14 Years Ago
                             Jeff, I am going to have to ask you to double check your logic then....
Trent L. Taylor - 14 Years Ago
                                 Hi Trent, The code below in the Web Form works fine andreturns the...
Jeff Pagley - 14 Years Ago
                                     No, otherwise the password would not be secure. It is embedded and...
Trent L. Taylor - 14 Years Ago
                                         Hi Trent, [codesnippet]One other thought, in the WinForm app,...
Jeff Pagley - 14 Years Ago
                                             Hi Jeff! I'm going to jump in here to keep this moving....
Greg McGuffey - 14 Years Ago
                                                 Greg/Trent, I will be glad to debug the code to find out what is...
Jeff Pagley - 14 Years Ago
                                                     Hi Jeff. 1 - Download and installthe source code from the SF website...
Ivan George Borges - 14 Years Ago
                                                         Hi Ivan, Thanks for the info. I already knew all of that, I must have...
Jeff Pagley - 14 Years Ago
                                                             About rebuilding it into Release mode during development, I think that...
Ivan George Borges - 14 Years Ago
                                                             Hi Trent, Here are the results once I have stepped through Login...
Jeff Pagley - 14 Years Ago
                                                                 Assuming I'm reading your post correctly, the IsDataValid method...
Greg McGuffey - 14 Years Ago
                                                                     [codesnippet] Assuming I'm reading your post correctly, the...
Jeff Pagley - 14 Years Ago
                                                                         Jeff, I've not forgotten about it. I am going to setup a test as I...
Trent L. Taylor - 14 Years Ago
                                                                             By the way, I did some more troubleshooting and found that the...
Jeff Pagley - 14 Years Ago
                                                                                 Not seeing the attachment Jeff....
Greg McGuffey - 14 Years Ago
                                                                                     I tried to attacheda samplesolution duplicating the problem along with...
Jeff Pagley - 14 Years Ago
                                                                                         Hi Greg, After clearing the attachments in my profile as you...
Jeff Pagley - 14 Years Ago
                                                                                             I haven't got this to run yet (I have to run an errand), but I did...
Greg McGuffey - 14 Years Ago
                                                                                                 You got to be kidding me!!!! After a week and half of shear fustration...
Jeff Pagley - 14 Years Ago
                                                                                                     I glad that fixed the issue. :D I'll talk to Trent about including a...
Greg McGuffey - 14 Years Ago
                                                                         Not forgetting, just trying to figure out why. :D Check that the...
Greg McGuffey - 14 Years Ago
                                                                             Good point, Greg!
Trent L. Taylor - 14 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search