This is rare, but sometimes when coding, things go haywire and the result is a page that won't load properly. We ran into an instance where we were unable to load a page we were making due to some bad code, and as such, we couldn't load the page on the back end of Rock to delete the page from there either. Normally you can delete by going to "Admin Tools - CMS Configuration - Pages" and navigating to your page and clicking the "Delete" button. But in our case, clicking on the page on the left column would again lock up the browser as it tried to load the bad code in a page block. The following is a method to find the page and delete it via the "Admin - Power Tools - SQL Command" tool.

1) Navigate to "Admin Tools - CMS Configuration - Pages" and navigate on the left until you can see the name of the page you wish to delete. If clicking the page name locks your browser up, then this method is for you. If it doesn't, you can simply edit/delete blocks here or delete the page itself using the built-in buttons on this page.


2) Assuming you can't click on the page name without it locking up, we need to find the ID of the page in question. You can do this by right clicking on the name and selecting "Inspect Element" in Firefox or Edge, or "Inspect" in Chrome. This opens up the browser's web tools and shows you the page code. We need to find the ID of that link it should be in the line above showing data-id="###" where the ### is the ID of that page.



3) Close the inspect window and go to "Admin - Power Tools - SQL Command" and delete the default text from the window and paste this SQL in, replacing ### with your page ID you found above. For our example, we will use 1574 as our page ID. This command isn't changing/deleting anything, rather it is just being run to confirm it is the correct page (that your page ID matches your page Title) you wish to delete. Click Run when ready.

SQL Text:

FROM [dbo].[Page]
WHERE [Id] = '###';


4) If the above query returns the correct page info you wish to remove, follow up with the following commands, again replacing ### with your page ID, and again, for our example we will use page ID 1574. Note that when you run this, there will be no fanfare. There is no success message or any indication that it did anything. You can optionally repeat step 3 if you want to confirm it now pulls "no results" when searching for that page.

SQL Text:

WHERE [Id] = '###';

WHERE [PageId] = '###';

DELETE FROM [PageContext]
WHERE [PageId] = '###';


5) Go to the bottom toolbar of an admin and pick the "i" symbol for info on the Rock install. Click the "clear cache" button. This tells Rock to re-read the database and see that the page is gone (removes it from menus and such). After the green success message appears, click Done at the bottom right.



That should be all you have to do. If you go back to the "Admin Tools - CMS Configuration - Pages" section, the page should be gone from your site now.