I am evaluating sitefinity and making a proof of concept. In said concept, we have an existing web application with an existing database and using asp.net membership provider for user authentication. In an ideal world, our development team, myself included, would take our existing application and fully migrate everything over to SF. However, this is not possible and the migration will be a slow process over the course of many months as existing functionality is built on top of the app. With that said, several pages will be initially chosen to be brought into SF.
Here is the current issue I am facing with our proof of concept. Many of our pages are protected and require a user to log in before accessing those pages. As a test, I created a test page lets call it "AdminTestPage" in SF. I've restricted it to allow only one of our specific roles in our asp.net membership provider. I have the AspNetSqlMembershipProvider installed and from the sitefinity login url, back end, can log in using one of our existing user accounts, currently pointing at my test database on my local machine. If I use the sitefinity login page and log in as say "MyTestAccount" and then go to the "AdminTestPage", I can get there.
I've created a custom control, successfully registered it in SF, and placed it on a page that I called "Login", also created in SF. This control is a login control that has two text boxes for username and password and a button for submitting.
Long story short, my main question is, how do I take the username and password provided by the user and programmatically log that user in? I've taken the code that we use in our existing app for logging in with membership. This is the delegate click event code that I added to my custom log in user control. However, when I go to my login page, enter my log in info and submit, I'm redirect to my home page I created. So at that point, everything seems to have functioned as I expected. Then I attempt to hit the "AdminTestPage" and am redirect to the sitefinity login page. At that point, I'm going, "I must not be logged in, perhaps my custom user control log in click delegate method is not functioning as I'd expect". So, is there anything special I have to do to get this to work? Meaning, when I go to my login page and enter my credentials (assuming they are correct), it should log me in and I should be able to go to my protected page.
sender, EventArgs e)
username = Username.Text;
password = Password.Text;
FormsAuthenticationTicket ticket =
FormsAuthenticationTicket(1, username, DateTime.Now, DateTime.Now.AddMinutes(20),
Expires = ticket.Expiration,
Path = FormsAuthentication.FormsCookiePath