Archive

Archive for the ‘BlogEngine.Net’ Category

How to Create BlogEngine.Net Extensions

September 19, 2010 1 comment

BlogEngine.NET is an open source .NET blogging project that was born out of desire for a better blog platform. A blog platform with less complexity, easy customization, and one that takes advantage of the latest .NET features.

BlogEngine.NET was designed using the current .NET framework and focused on simplicity, ease of extendibility, and innovative features. With BlogEngine.NET, we hope to create the natural blog of choice for all .NET developers world wide. Read More…

In recent past, we evaluated different open source blogging platforms and decided to use BlogEngine.Net due to its simplicity, robust core and ease of extendability.

    BlogEngine.Net can be extended in many ways, we can create themes, widgets, controls and our own custom extensions.

    Extensions allows you to write a class that can hook up to all the various events that are exposed in the application in a very simple manor. Following are links to some good articles on how to develop BlogEngine.Net extensions:

    Categories: BlogEngine.Net Tags:

    SendCommentMailToPostAuthor–BlogEngine.Net Extension

    September 7, 2010 Leave a comment

    BlogEngine.Net provides a default extension SendCommentMail “Sends an e-mail to the blog owner whenever a comment is added” – this extension is useful in cases when there is a single author (editor) in your blog as it sends every new comment notification to blog owner only. But in a multi-author (editor) blog, where multiple authors create posts on BlogEngine.Net blog, this extension is not much useful.

    If you have a multi-author blog and require that new comment notification is sent to respective post author, my new extension SendCommentMailToPostAuthor “Sends an e-mail to the post author whenever a comment is added” can serve your purpose.

    SendCommentMailToPostAuthor is created as a copy of SendCommentMail (by BlogEngine.Net) and modifying the code to send comment email to post author instead of blog owner.

    To install this extension you just need to copy one file, SendCommentMailToPostAuthor.cs, into ~/app_code/extensions folder.  I have pre-configured the extension with an email subject and body but feel free to customize it to your liking.

    SendCommentMailToPostAuthor.zip (2.1 kb)

    Integrating FCKeditor with BlogEngine.Net

    September 1, 2010 Leave a comment

    For six years, FCKEditor has been a widely used implementable text editor for web applications. It succeeds in providing web programmers to produce content management systems that can produce dynamic content very quickly for almost any web development language. FCKEditor is one of the most used advanced text editors on the Internet. The things that make it particularly very impressive are its professional look and its support for multiple languages.

    By default BlogEngine.Net supports TinyMCE, BE mentions that other editors can also be used. If you want to replace TinyMCE with FCKEditor, there is no definite guide on this topic. Recently, i came across a requirement to use FCKeditor with BlogEngine.Net. I came across a very nice post on BE discussion forum “Problem using fckeditor“. By following these steps, i was able to use FCKeditor without any error. Following is the extract from the same post:

    Here is what i did to make it work. I provide all steps to have a complete documentation. “Webroot” is the directory where you installed BlogEngine.Net in. You should change the web.config in the last step, because you have to restart your application anyway.

    • Download the FCKEditor main package at http://www.fckeditor.net/download .
      • Extract the zip file to your webroot. You now have a folder fckeditor in your webroot.
    • Download the FCKEditor.NET package at http://www.fckeditor.net/download .
      • Extract the zip file to a temporary folder.
      • Copy FredCK.FCKeditorV2.dll from {temporary folder}\bin\Release\2.0\ to the \bin\ directory of your webroot.
    • Create a folder “userfiles” in your webroot. Add write permissions to this folder for the Network Service account (Windows Server 2003).
    • Switch off HTTP compression in the blog settings
    • add_entry.aspx ({webroot}\admin\Pages\):
      • add <%@ Register Assembly=”FredCK.FCKeditorV2″ Namespace=”FredCK.FCKeditorV2″ TagPrefix=”fck” %>
      • replace <Blog:TextEditor runat=”server” id=”txtContent” TabIndex=”4″ /> with <fck:FCKeditor id=”txtContent” runat=”server” BasePath=”/FCKeditor/” Height=”700″ Width=”800″ />
      • remove upload fields (txtUploadImage, txtUploadFile)
    • add_entry.aspx.cs ({webroot}\admin\Pages\):
      • replace txtContent.Text with txtContent.Value
      • remove all references to the old upload fields (txtUploadImage, txtUploadFile)
      • the function SizeFormat() can also be removed
    • fckconfig.js ({webroot}\fckeditor\):
      • set _FileBrowserLanguage to ‘aspx’
      • set _QuickUploadLanguage to ‘aspx’
    • config.ascx ({webroot}\fckeditor\editor\filemanager\connectors\aspx\):
      • you have to implement a session check in CheckAuthentication() or just return true (not recommended)
    • Set enableSessionState=”true” in the <pages> section in web.config
    There are a couple of disadvantages of this approach:
    1. This integration is done by making changes to BE core, this will create problems in version upgrades.
    2. TinyMCE is fully XHTML compliant, but for FCKeditor no such claim can be made.

    Twitter Extension For BlogEngine.NET

    While searching for twitter extension for BlogEngine.Net, i came across following extension. It works perfect for BlogEngine 1.4. It is not posting tweets for BlogEngine 1.6.x though.

    http://www.migueljimenez.net/post/2008/07/02/TwitterPing-10-Twitter-Extension-for-BlogEngineNET.aspx

    Categories: ASP.Net, BlogEngine.Net

    BlogEngine.NET with ASP.NET 4.0

    July 18, 2010 1 comment

    Today i setup BlogEngine.Net 1.6.1 with ASP.Net 4.0 for the first time. Initial setup was smooth and there was no problem in the setup.

    When i tried to add a new post, BlogEngine.Net threw following exception:

    Error Details:

    Raw Url : /BE/admin/Pages/Add_entry.aspx
    Message : A potentially dangerous Request.Form value was detected from the client (ctl00$cphAdmin$txtContent$TinyMCE1$txtContent=”

    Prior to ASP.Net 4.0 this exception was only thrown if HTML tags are entered in an input field and page level validateRequest is set to true. I checked the source code for “/admin/Pages/Add_entry.aspx” and verified that validateRequest  was already set to “false” – I also added the validateRequest=”false” to web.config but the error was still there.

    By searching for such errors with ASP.Net 4.0, i was able to find a solution at http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes#0.1__Toc256770147 – By setting up requestValidationMode to “2.0”, the request validation errors were removed.


    <httpRuntime requestValidationMode="2.0" />
    This URL also lists other breaking changes in ASP.Net 4.0: