We are upgrading from 6.4 to 8.2 and we have some custom login pages for several clients. I used to be able to do something like this:

if (
(System.Web.Security.Membership.GetUser(usernameBox.Text).IsApproved) &&
(Sitecore.Security.Authentication.AuthenticationManager.Login(usernameBox.Text, passwordBox.Text, false))                
    redirectUrl = Page.Request.Url.GetLeftPart(System.UriPartial.Authority) + "/sitecore/shell/default.aspx";

But if I do that now it sends me to the default Sitecore login page. I know that it logins them in and as long as I don't try to get into the content management part it is fine. It is like they are not getting the right cookie. Do I need to use something besides AuthenticationManager?

  • Where are you suppose to redirect them to? Dec 20 '17 at 15:13
  • We are sending them to the desktop but I have tried the launchpad too.
    – Jeremy
    Dec 20 '17 at 15:23

You have redirect user to "/sitecore" instead. You will also need to create the cookie by calling createticket function. Here's a snippet of what should be called after AuthenticationManager.Login.

string ticket = Sitecore.Web.Authentication.TicketManager.CreateTicket(userName, @"/sitecore/shell");
HttpContext current = HttpContext.Current;
if (current != null)
    HttpCookie cookie = new HttpCookie(Sitecore.Web.Authentication.TicketManager.CookieName, ticket)
        HttpOnly = true

Make sure you test item preview and experience editor as you might experience other issues.

  • I tried it with just "/sitecore" but it still sends me to the default Sitecore login page.
    – Jeremy
    Dec 20 '17 at 16:13
  • Are these virtual users or existing sitecore users?
    – josedbaez
    Dec 20 '17 at 16:16
  • They are existing sitecore users.
    – Jeremy
    Dec 20 '17 at 16:19
  • weird. Can you try this function. We had to do it to fix preview, but might help you. Ill update the answer if it fixes it. josedbaez.com/2017/09/sitecore-okta-login/#ticket-function
    – josedbaez
    Dec 20 '17 at 16:20
  • That fixed it. I guessing it doesn't automatically create the tickets anymore.
    – Jeremy
    Dec 20 '17 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.