DNN Forums

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

How to Delete a Portal?

Sort:
You are not authorized to post a reply.
Page 1 of 212 > >>





New Around Here





    Hello guys,

    I have to delete all of our site portals. But the delete function isn't working propery. It always says an error occured. Can this be done manually? 

    Thanks. 

     






    Advanced Member





      Can you look at the Admin Logs and see if there's a corresponding error logged? Or see if there are any details in the network traffic?
      DNN partner specializing in custom, enterprise DNN development https://engagesoftware.com/showcase





      New Around Here





        Hi Brian

        This is the error I think. I'm not sure how relevant it is. 






        Advanced Member





          Click on those to expand them to see details. There will probably be an error message and hopefully a stack trace which can help you pinpoint what the underlying issue is.
          DNN partner specializing in custom, enterprise DNN development https://engagesoftware.com/showcase





          New Around Here





            Here's the expanded view of the error. I'm sorry, I have now idea what's going on. 






            Advanced Member





              That is an issue that should get resolved, but it doesn't appear to be related to deleting a portal. Are there other log entries that have anything related to deleting portals?
              DNN partner specializing in custom, enterprise DNN development https://engagesoftware.com/showcase





              New Around Here





                Hi Brian,

                No that's the only thing that looks serious. The other one was just a simple error something like 404, can't load a font.





                Advanced Member





                  Okay, well, to resolve that error we need to introduce a binding redirect. I thought 2Sxc automatically added these, so maybe the first step is to see if there's a newer version of 2Sxc to upgrade to (preferably one of their LTS releases).

                  If you still continue to see that error, that's where the binding redirects come into play. If you look at your web.config file (either via the file system or through the Config Manager in the Persona Bar) and search for bindingRedirect you will see a section of the file with entries like this:

                        <dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
                          <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
                          <bindingRedirect oldVersion="0.0.0.0-32767.32767.32767.32767" newVersion="12.0.0.0" />
                        </dependentAssembly>

                  What this is saying is that the assembly (DLL file, compiled code) with the given identity (name is Newtonsoft.Json, signed with the public key 30ad4fe6b2a6aeed) is valid for use when any version is requested (i.e. in the range from version 0.0.0.0 to version 32767.32767.32767.32767) and should use the version 12.0.0.0. This newVersion value needs to match the version of the DLL file in the bin folder.

                  So, in your case, you need to see if there's an existing binding redirect for Microsoft.Extensions.DependencyInjection.Abstractions. If there is, make sure version 1.1.0.0 is included in the oldVersion range. If there isn't, you'll want to add one. The tricky part here is knowing the specific version of the assembly file in the bin to use for the newVersion. There are many different versions associated with the file, so it's not very straightforward to determine what the correct version is. If you use the wrong version, your site won't work at all. You should be able to retrieve the version using Powershell, with the following snippet (using your website's path): [System.Reflection.AssemblyName]::GetAssemblyName('C:\inetpub\wwwroot\mysite.com\bin\Microsoft.Extensions.DependencyInjection.Abstractions.dll').Version.ToString().

                  After you've added/updated the binding redirect, you'll want to see if that resolved the issue. It may be that there's another missing binding redirect that you need to add next.

                  If you get into a scenario where your versions don't match and the site isn't working, I have a Powershell module which has a command to synchronize the binding redirects in the web.config with the files in the bin (though it won't add new binding redirects). To use that, run Install-Module -Name BindingRedirects (see the getting started docs if Install-Module isn't available on your system). Once it's installed, call Sync-BindingRedirect 'C:\inetpub\wwwroot\mysite.com\web.config' to update any incorrect binding redirects.

                  Hope it helps!

                  DNN partner specializing in custom, enterprise DNN development https://engagesoftware.com/showcase





                  New Around Here





                    Hi Brian,

                    Sorry for late reply, and than you for helping us out fix the error. We were able to fix it.

                    But we still can't delete a portal. Is there a way to do it manually and clean? Thanks.






                    Advanced Member





                      Ultimately the code you're trying to run is https://github.com/dnnsof...roller.cs#L154-L195. There's a lot going on in there, so any manual deletion is likely to miss a step or two.

                      This deletes any localized files (e.g. *.Portal-2.resx), the child portal folder(s) (e.g. /my-portal if the URL is mysite.com/my-portal), and the portal folders (e.g. Portals/2 and Portals/2-System).

                      Then it deletes each user in the portal, which is its own long, involved process, ultimately calling the SQL stored procedure EXEC DeleteUserPortal @userId @portalId; for each user, and finally deletes the portal by running the SQL stored procedure EXEC DeletePortalInfo @portalId;

                      All that said, I would suggest continuing to try to find some details on what's causing the delete request to fail. If you're concerned that the site is still "live" while you're troubleshooting, you can use a temporary site alias URL and remove all of the previous URLs so that no one can find the site anymore.

                      I would start by looking at the network traffic in your browser tools, and see if the error response to the delete request includes any details. You can also look in the log file if there isn't anything logged to the Admin Logs. You can see the log file via the Servers section of the Persona Bar.

                      DNN partner specializing in custom, enterprise DNN development https://engagesoftware.com/showcase
                      You are not authorized to post a reply.
                      Page 1 of 212 > >>

                      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