This project is read-only.

Cannot delete pages in BlogEngine.NET 1.4.5

Topics: ASP.NET 2.0, Controls
Mar 31, 2009 at 6:30 PM
Even if i am logged on as the administrator and click on a page under "Page List" i am unable to delete the page by clicking Delete (next to Edit) at the bottom of the post. Strangely enough i can Edit a post but cannot delete it. This occurs both on the remote shared host and in visual on my local host.

I made sure in users that Administrators and Editors was selected for the user i am logged in for. I have not made any changes to the code except to make minor changes to the H1 and H2 tag in the CSS files.
If anyone can help that would be appreciated.

Mar 31, 2009 at 7:28 PM
What happens when you try to delete a Page?  Are you still on the same Page as before?  Any errors happening?  Do you see any JavaScript errors occuring when you click 'Delete'?  If you're using Firefox, you can check the Error Console for any JavaScript errors (Tools -> Error Console).  Can you delete a regular post (not page)?
Mar 31, 2009 at 7:51 PM
Yes it stays on the same page as before after i click on delete. I first get a messege box asking me if im sure i want to delete the page. After selecting yes the same page appears and is not deleted.

If i move the cursor over the delete button in the bottom left of the screen in IE it will display: Javascript void(0);  Whereas it will display the page if i place the cursor over the Edit button.

Im using Internet Explorer. I've just noticed the problem occurs in IE 6.0 and Opera browser but not the firefox browser.
I cant understand why this is occuring. Other people must be experiencing the same problems.

Mar 31, 2009 at 8:10 PM
So it works in Firefox?  In IE, after you click 'delete', can you see if the page is posting to the server?  Or does it look like nothing at all happens?  What is the URL in the address bar after confirming deletion?  Same URL?  Also, are you running this blog on your local machine?

After you confirm deletion, it should navigate you to a URL similar to

Where "Example-page" is the name of the page, and the value after "deletepage=" is the unique Guid of your page.  You can find the unique Guid value by going into the App_Data\pages directory and looking for your page.  If you find it, you can try navigating directly to that page in IE to see what happens.
Mar 31, 2009 at 8:49 PM
Edited Mar 31, 2009 at 9:36 PM

Yes it works in firefox but not IE. When I click 'delete' nothing happens. The page just flickers quickly but the URL is exactly the same. Whether I run it on my local machine or remote host the same appears in IE and Opera but works in firefox. It does not delete a page when i press Delete.

I tried enabling pop-ups and resetting some of the settings in IE to their defaults but it still does not work.

When I press delete in firefox it deletes the page then sends me to the home page. However I never see something like the following in any browser:
Mar 31, 2009 at 10:03 PM
In Firefox, you are actually being redirected to that URL containing deletepage=... but you wouldn't normally see it in your address bar.  Once the delete has completed, BE then redirects you back to the homepage.

You can still manually navigate to that URL for your page in IE to try and initiate the deletion.  You would want to replace those values (Example-page and the unique Guid) with the values for your page.

If you're seeing the page flicker after confirming deletion, try pressing F5 after that.  Does IE give you a warning box saying it needs to resend information you previously submitted -- Retry or Cancel?

If you do see that warning message when pressing F5 after attempting to delete the page, this probably means a JavaScript error is occurring.  I'm not sure why the deletion confirmation box (which is done via JavaScript) would work, but the part that navigates you to the deletepost=... URL doesn't work.

If you don't mind skipping the deletion confirmation box, you can remove the JavaScript portion of this 'Delete' link and have it go directly to the URL that does the deletion.  In the root of your blog, there's a page.aspx.cs file.  Towards the bottom of that file, there's this line in it:

sb.AppendFormat("<a href=\"javascript:void(0);\" onclick=\"if (confirm('Are you sure you want to delete the page?')) location.href='?deletepage={0}'\">{1}</a>", this.Page.Id.ToString(), Resources.labels.delete);

If you replace that line with the one below, then clicking the "Delete" link will delete it without any confirmation and will probably work in IE -- assuming the problem is some strange JavaScript error that is happening.

sb.AppendFormat("<a href=\"?deletepage={0}\">{1}</a>", this.Page.Id.ToString(), Resources.labels.delete);
Apr 1, 2009 at 7:43 AM
Thanks for your replys. It is much appreciated.

I tried pressing F5. I did not get any warning box from IE saying it needs to resend the information.

However when i replaced the the code with the one you gave me to prevent the confirmation box from appearing it did work in IE

It still would be nice to know why the error is occuring. I'll let you know if i find out the cause of the problem.


Apr 1, 2009 at 7:54 AM
Glad to hear that works.

If you go back to the original code, you could look for JavaScript errors in the status bar of IE.  Add-ons to IE or internet security suites could potentially interfere with the process.

It's also possible your security settings in IE are too high -- or the blog URL is in a restricted zone in IE.  In IE's status bar, while at the blog, you should see the zone you're in -- Internet, Local intranet, Trusted sites, Restricted sites.  You could try putting the blog website URL in the Trusted Sites zone.  Tools -> Internet Options -> Security tab, select Trusted sites at the top, then click the "Sites" button, and put the blog URL in the input box and click "Add" (you might need to uncheck the box at the bottom about requiring server HTTPS verification).
Apr 1, 2009 at 8:02 AM
Edited Apr 1, 2009 at 8:03 AM
Unfortunately i've just noticed that there is no edit button when i use the code you gave me which means I have to keep changing the code around whenever i want to edit or delete a page.

Apr 1, 2009 at 8:11 PM
You should have an Edit link.  The only change we did was to the Delete link.  You may have accidentally deleted the Edit link.  Here's what the entire AdminLinks code should look like in page.aspx.cs.

public string AdminLinks
        if (System.Threading.Thread.CurrentPrincipal.Identity.IsAuthenticated)
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("<div id=\"admin\">");
            sb.AppendFormat("<a href=\"{0}admin/Pages/Pages.aspx?id={1}\">{2}</a> | ", Utils.RelativeWebRoot, this.Page.Id.ToString(), Resources.labels.edit);
            sb.AppendFormat("<a href=\"?deletepage={0}\">{1}</a>", this.Page.Id.ToString(), Resources.labels.delete);
            return sb.ToString();

        return string.Empty;
Apr 2, 2009 at 8:18 AM
Edited Apr 2, 2009 at 8:29 AM
Yes I must have accidentally deleted the edit link. The edit and delete buttons are appearing now and I can delete the pages. Thank you.

On a different topic is it possible to have a title meta tag that differs from the H1 tag or must they be the same. Maybe im being fussy  but I may not necessary want the title meta tag to be the same as my blog name and description.

For example if my blog name/ heading is then the title meta tag will be which may not be seo friendly.

I just want to congratulate the makers of . It’s the best blog engine I have seen yet. It has many great features yet seems to download quickly. If I make money out of blogging I will consider giving a donation.

Apr 2, 2009 at 8:39 AM
Title meta tag ... do you mean the <title></title> tag?  Usually that title tag is going to be the Name of the blog | Description of the blog.  Both the name of the blog and the description of the blog are defined on the Settings tab in the control panel.

On the individual blog post pages, the title tag is going to be the name of the blog entry, unless you select the "Use blog name in page titles" checkbox on the settings tab in the control panel.  If that box is checked, then when on an individual blog post page, the title tag is going to be Name of the Blog | Title of the Blog Post.
Apr 2, 2009 at 9:48 AM
yes i meant the <title> </title> tag. The title tag is going to be the name of the blog | Description unless i De-select "Use Blog name in page titles" which is what i always do. 

Being able to de-select "use blog name in page titles" is a great improvement on the earlier versions as I dont want the same text for each <title> tag. However it would be nice if i could also choose to have a different <h1> tag or blog name to the title Tag which displays on search engine results.

For example if i did not want any blog name or description on the home page I would not be able to generate a <title> </title> tag as the <title> tag is dependent on the blog name.