More in this section

Forums / General Discussions / SetAuthenticationCookie in RC2

SetAuthenticationCookie in RC2

2 posts, 0 answered
  1. Matt
    Matt avatar
    56 posts
    Registered:
    20 Nov 2009
    23 Dec 2010
    Link to this post
    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

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Dec 2010
    Link to this post
    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
2 posts, 0 answered