• Login
  • Register

DNN Forums

A community discussion page. We're starting from scratch, so...let's get the party started!

Getting PortalId

You are not authorized to post a reply.
Sort:


New Member


Posts:8
New Member

    Hi,

    I am trying to get the PortalId from the PortalSettings object. I am calling the GetCurrentPortalSettings() to get the PortalSettings object from which I am getting the PortalId.

    The problem is in some of our client's sites (only some), the GetCurrentPortalSettings() object is null. It is working in my local development site and in our QA sites but returns null in some our client's sites.

    Any idea why? Thanks in advance.



    Basic Member


    Posts:58
    Basic Member

      In what context are you using this? MVC module? WebForms Module? etc?
      Mitchel Sellers
      Technology Advisory Group Leader
      CEO @ IowaComputerGurus, Inc. a DNN & .NET Solutions Provider
      Technical Blog: MitchelSellers.com


      New Member


      Posts:8
      New Member

        WebForms module



        Veteran Member


        Posts:483
        Veteran Member

          If you look in the Portals database table, do all of the portals have valid ids?
          Joe Craig
          DNN MVP
          Patapsco Research Group


          New Member


          Posts:8
          New Member

            If you look in the Portals database table, do all of the portals have valid ids?


            Yes. The client in question has only one portal and it has the id 0 in the Portals table.


            Veteran Member


            Posts:563
            Veteran Member

              Posted By Mohan on 14 May 2020 05:52 PM
              If you look in the Portals database table, do all of the portals have valid ids?


              Yes. The client in question has only one portal and it has the id 0 in the Portals table.

              And I guess they are all the same DNN version?

               

               



              New Member


              Posts:8
              New Member

                Yes. 9.4.4


                New Member


                Posts:8
                New Member

                  An extra note:
                  I am calling the GetCurrentPortalSettings() method as below.

                  DotNetNuke.Entities.Portals.PortalController.Instance.GetCurrentPortalSettings()

                  I am using .Instance because if I don't, its complaining that PortalController.GetCurrentPortalSettings() is deprecated
                  You are not authorized to post a reply.

                  These Forums are dedicated to 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. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
                  2. 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.
                  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
                  4. No Flaming or Trolling.
                  5. No Profanity, Racism, or Prejudice.
                  6. Site Moderators have the final word on approving / removing a thread or post or comment.
                  7. 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