Location of DeletePost method

Topics: ASP.NET 2.0, Business Logic Layer, Controls
Nov 9, 2008 at 10:18 PM
Hello,

Can anyone tell me where I can find the DeletePost method? A 'find' search reveals nothing and I'm wondering if there are hidden files to confuse us nubies :-)

Many thanks
Amy
Nov 10, 2008 at 10:24 AM
Edited Nov 10, 2008 at 10:26 AM
There are tons of "hidden files", well not really hidden but they are built into the DLL files. A quick scan of the source leads me to believe you may be looking at BlogBasePage.cs with the following code.

if

 

(!Page.IsPostBack && !string.IsNullOrEmpty(Request.QueryString["deletepost"]))

 

{

 

 

if (Page.User.Identity.IsAuthenticated)

 

{

 

 

Post post = BlogEngine.Core.Post.GetPost(new Guid(Request.QueryString["deletepost"]));

 

 

 

if (Page.User.IsInRole(BlogSettings.Instance.AdministratorRole) || Page.User.Identity.Name == post.Author)

 

{

post.Delete();

post.Save();

Response.Redirect(

 

Utils.RelativeWebRoot);

 

}

}

}

 



Are you building from source? With all the changes you are trying it might be a good idea.
A suggestion for you too:
Why not just rename your existing Default.aspx page to Index.aspx or whatever and change your default doc on your web to that? Upgrades will be so much easier than trying to change all those files each time BE is upgraded. Version 1.4.5.10 is the latest in source and has some very useful bug fixes in it. You will want to upgrade at some point.
Sorry for the bad code formatting. cut/paste into the wysiwyg editor always messes up my formatting.