DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

DNN 9 login to default login page programmatically

Sort:
You are not authorized to post a reply.





New Around Here





    I create my dnn website and it contains 3 other sites

    I have another project where I'm using to login my user and then redirect to respective dnn site 

    code I'm using is 
    var user = DotNetNuke.Entities.Users.UserController.GetUserByName(portalId, userName); DotNetNuke.Entities.Users.UserController.UserLogin(portalId, user, portalName, IP, CreatePersistentCookie); this.Response.Redirect("https://mydnnsite.me");  //this site is my third site on same website with portalID 3

    after it redirects to my site,I'm still seeing the login button but when I checked the admin logs I can see it says LOGIN SUCCESS

    Whats am I doing wrong here 






    Growing Member





      Mohit, each website portal has its own set of users and so has a separate login. You are seeing that they logged in successfully on portal 3 (their entry point) and then when they get redirected to another portal, the destination portal requires an independent login. So they have to login there also. There are a number of strategies for Single-Sign On, and I don't know them all. But let me give you a few options that I do know.
      First, do they really need to log into portal 3? Can you redirect them to the right portal without logging them in? If so, then they only need to login once and that would be on the destination portal.
      Second, there are modules that will give you the ability to create a link that will log a user in automatically when they use the link. That could be great, or it could also be a security risk depending on your situation. I think another module fixes things for Single Sign On so if you log into one portal, you are automatically logged into another. Do a search in the DNN Store for login modules to see what is offered.





      New Around Here





        Hi Mark, 

        Thanks for the reply. Here I'm logging the user, say in portal 3, and redirecting the user to the same portal, not another portal. 
        I have a registration page in another project where the user register and then the login page is called which is in my DNN site to log in  the user via code automatically so when the user is redirected to the portal site he is already logged in. 






        New Around Here





          I think I solved the issue, I was calling the login page by using my portal subdomain (https://portal1.mysite.me/loginPage.aspx) and when I called using the page with subdomain same as the portal 3 (https://portal3.mysite.me/loginPage.aspx) it worked.

          Thanks Mark your reply really helped me.

          You are not authorized to post a reply.

          These Forums are dedicated to the discussion of DNN Platform.

          For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

          1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
          2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
          3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
          4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
          5. No Flaming or Trolling.
          6. No Profanity, Racism, or Prejudice.
          7. Site Moderators have the final word on approving / removing a thread or post or comment.
          8. English language posting only, please.

          Would you like to help us?

          Awesome! Simply post in the forums using the link below and we'll get you started.

          Get Involved