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. (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 .
    • Extract the zip file to your webroot. You now have a folder fckeditor in your webroot.
  • Download the FCKEditor.NET package at .
    • 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.

Create DNN Schedule in Code

August 28, 2010 Leave a comment

In one of my previous posts, i described the mechanism to schedule a tasks in DotNetNuke.

DNN provides a user interface to create and manage scheduled tasks (a.k.a Schedule Items), you can access the schedule items by logging in as Host and navigating to Host -> Schedule. You can manage already created schedule items here and you can create new schedule items as well.

But, if you want to create a schedule item in code, following piece of code will help you.

Code: Create Schedule Item

private DotNetNuke.Services.Scheduling.ScheduleItem CreateScheduleItem(
    String friendlyName,
    String typeFullName,
    String objectDependencies,
    int timeLapse,
    String timeLapseMeasurement)
    DotNetNuke.Services.Scheduling.ScheduleItem objScheduleItem =
        new DotNetNuke.Services.Scheduling.ScheduleItem();
    objScheduleItem.FriendlyName = friendlyName;
    //ONLY Supported in 05.02.xx and above versions

    objScheduleItem.TypeFullName = typeFullName;
    objScheduleItem.TimeLapse = timeLapse;
    objScheduleItem.TimeLapseMeasurement = timeLapseMeasurement;
    objScheduleItem.RetryTimeLapse = 1;
    objScheduleItem.RetryTimeLapseMeasurement = "m";
    objScheduleItem.RetainHistoryNum = 100;
    objScheduleItem.AttachToEvent = "";
    objScheduleItem.CatchUpEnabled = false;
    objScheduleItem.Enabled = false;
    objScheduleItem.ObjectDependencies = objectDependencies;
    objScheduleItem.Servers = Null.NullString;
    return objScheduleItem;

Code: Add the Schedule Item to DotNetNuke

DotNetNuke.Services.Scheduling.ScheduleItem item =
CreateScheduleItem("Test Item", "TypeFullName", "", 10, "m");

int scheduleID = 

Schedule a Task in DNN

August 23, 2010 1 comment

DotNetNuke provides a robust framework for scheduled tasks. Some tasks are already scheduled by DotNetNuke installation and you can also add your own custom tasks to the DotNetNuke schedule.

DotNetNuke schedule is accessible from the Host -> Schedule screen. This screen lists all of the scheduled tasks also called schedule item. You can see status, history and properties of each schedule item.

You can find more details about DotNetNuke Scheduler in this PDF document.

You can find more details about creating a DotNetNuke schedule item in following posts:

The first step in creating a Schedule Item is to create a DotNet Assembly that will contain the logic to execute the scheduled task. Your class for task execution should inherit from DotNetNuke.Services.Scheduling.SchedulerClient. Once the Assembly is ready, you can create a new Schedule Item by going to Host -> Schedule -> Add Item to Schedule.

Export DataTable to PDF

August 8, 2010 Leave a comment

In one of my previous posts Create PDF Documents in ASP.NET, I explained how we can create PDF document in ASP.Net applications.

By using the open source iTextSharp library, i have created a class to export a Data Table to PDF document. This is an initial version of the utility class. This can be used to export a Data Table to PDF document in the form of table. This class uses iTextSharp dll for creating PDF document. To start using this utility, you will need to download the iTextSharp library from and reference it in your project.

Click here to download source code for DataTable2PDFDocument.

Create PDF Documents in ASP.NET

August 7, 2010 Leave a comment

If you want to create PDF documents in your Dot Net web/desktop application, without purchasing any 3rd party control, then iTextSharp is the right choice for you. iTextSharp is an open source library distributed under GNU Public License. You can freely use this component in your personal and commercial applications.

iText# (iTextSharp) is a port of the iText open source java library for PDF generation written entirely in C# for the .NET platform. Use the iText mailing list to get support.

Project page at SourceForge contains DLL and source for this nice library.  You can also find some example projects on the files page.

You can find a brief article and source code example on a code project article Creating PDF Documents in ASP.NET

Please note, iTextSharp is useful where you want to create a PDF document with custom text. With iTextSharp you will have to create the text for PDF in code (see examples or code project article for details). But if you want to convert HTML text or a HTML page to PDF directly, you will either have to extend iTextSharp or you will have to use some other component or library, you can give a try to ABCpdf.Net for conversion purposes.

If you want to use iTextSharp to convert HTML to PDF, you can start it by reading a very good article “iTextSharp – Simplify Your HTML to PDF Creation” at

I am working on a generic control that will create a PDF file from a DataTable, i will share the control once it is ready.

Categories: ASP.Net, PDF Tags: , , ,

Sending a Meeting Request

August 4, 2010 Leave a comment

Recently i came across a requirement where we need to send meeting/event invitation in email. Previously, i used to create ICS/iCal file with meeting/event information and this file was attached with the email. End user had to open the attached file to add it to calendar program. But sending an inline (native) meeting invitation was kind of a new requirement. See sample meeting invitations screen below:

Sample Meeting Request Gmail

Sample Meeting Request Gmail

Sample Meeting Request Outlook

Sample Meeting Request Outlook

Following post helped me in understanding the process to send inline meeting invitations/requests.

I have created a class (with the help of code mentioned in above post) to wrap up the functionality of meeting requests. Code can be downloaded here.

Usage of this class is very simple, e.g. if you want to send a meeting request from ASP.Net code, simply call the method in following manner:

MailMessage msg = KP.Web.Mail.CalanderInvite.GetCalanderInviteMsg(“”, “From Name”, “”, “To Name”, “SUBJECT”, “BODY TEXT”, DateTime.UtcNow.AddHours(2), DateTime.UtcNow.AddHours(3));