I've been searching around the forums and the net for a way to essentially log in a user without having to enter the credentials in the log in page.
The setup we have is an existing site with our own users and roles and a separate Sitefinity web site. What I want to achieve is to seamlessly authenticate our existing users in Sitefinity.
So, I've implemented a service in the Sitefinity application that should log in the users. If they do not exist, I create a new one, settings the appropriate roles and then I try to authenticate the newly created user.
The users and roles are created and assigned as they should, but when authenticating the user, even when I get the UserLoggingReason.Success return code from the calls, that user is not logged in.
Calls to pages with specific view permissions set are "not served".
In the Response.Cookies.Add(new HttpCookie(name, value)); you pass an empty name and value. Shouldn't they be initialized with something first? Or should it be one of the cookies that are read earlier?
Also, I just upgraded to 4.1 SP2, no change.
Posted by Community Admin on 29-Jun-2011 00:00
You can modify the code as below
// Invoke the method and return the response.
using (var response = (HttpWebResponse)request.GetResponse())
// Store the cookies from the response for the current session.
cookies = response.Cookies;
// Read the response
using (var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
The empty strings are left for some tests and if you want to pass the cookies from another storage where you need to set name and value and return the correct response.
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>