SetAuthenticationCookie in RC2

Posted by Community Admin on 03-Aug-2018 20:15

SetAuthenticationCookie in RC2

All Replies

Posted by Community Admin on 23-Dec-2010 00:00

Where is SetAuthenticationCookie in RC2?  Seems that it is now internal to SecurityManager, so this line fails to compile.  Is there a new way to login programmatically?

var now = DateTime.UtcNow;
var ip = SystemManager.CurrentHttpContext.Request.UserHostAddress;
var manager = UserManager.GetManager();
var user = manager.GetUser(username);
user.IsLoggedIn = true;
user.LastLoginIp = ip;
user.LastLoginDate = now;
user.LastActivityDate = now;
SecurityManager.SetAuthenticationCookie(SystemManager.CurrentHttpContext.Response, "Default", user, false);
manager.Provider.SuppressSecurityChecks = true;
manager.SaveChanges();
manager.Provider.SuppressSecurityChecks = false;


Thanks,
Matt

Posted by Community Admin on 27-Dec-2010 00:00

Hello Matt,

The method was set to internal, so you cannot use it anymore. You can use our Login control, try using AuthenticateUser or follow this post to authenticate the user by using a web request.



All the best,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed