ILMerge – Merge .Net Assemblies
ILMerge is a utility for merging multiple .NET assemblies into a single .NET assembly. It works on executables and DLLs alike and comes with several options for controlling the processing and format of the output. See the accompanying documentation for details.
ILMerge is a utility that can be used to merge multiple .NET assemblies into a single assembly. It is freely available for use from the Tools & Utilities page at the Microsoft .NET Framework Developer Center.
DotNetZip – Zip file manipulation in .NET
DotNetZip is a small, easy-to-use class library for manipulating .zip files. It can enable .NET applications written in VB.NET, C#, or any .NET language, to easily create, read, and update zip files. Zip Compression is easy with DotNetZip. The DotNetZip project also produces a GUI ZIP tool, and a few command line tools.
DotNetZip works on Windows-powered PCs with the full .NET Framework, and also runs on Windows Mobile devices that use the .NET Compact Framework. Create and read zip files in VB, C#, or any .NET language. The library can also be used from COM enironments, like PHP, Classic ASP, or VB-Script. DotNetZip supports these scenarios:
- creating a zip archive, adding files or directories into the archive
- listing files in an archive, extracting files from an archive
- modifying an existing archive – renaming entries, removing entries from an archive, or adding new entries to an archive
- creating zip files from stream content, saving to a stream, extracting to a stream, reading from a stream
- dynamically creating ZIP files from ASP.NET applications
Read more at http://dotnetzip.codeplex.com/
window.location not working in IE 6
For some unknown reason, IE 6 Java-script engine doesn’t allow me to a new URL by simply changing the window.location or window.location.href properties.
The very same thing is working fine in IE 7/8, Chrome and Fire-fox. But IE 6 is doing nothing on a call like window.location.href = url; No error is returned and location of page remains the same.
On searching for this issue, i came to following solution.
This problem is resolved by replacing the direct java-script to a custom function call like:
function SetWindowLocation(url)
{
setTimeout(function()
{
window.location = url;
}, 0);
}
Calling this function will change the location in all browsers including the funny IE 6.
The Award Night
On October 8, 2010 we participated in P@SHA ICT Awards 2010.
It was a very unique experience for our team as our product Ultrabot (Learning Simplified) by Knowledge Platform was sent as nominee of awards for the first time. Ultrabot was contesting for the award in the e-Learning category.
Once we saw our product in the Finalists List, our excitement was doubled and we kept our fingers crossed for our hopes to be a winner. And finally our hard work, dedication and team work got reward and an award. Ultrabot was declared the winner in e-Learning category.
It was a moment of joy for the whole KP team but I am sure, this was just the right beginning, there will more awards to come for our very own Ultrabot in future.
Good luck Ultrabot. Good luck KP.
Accessing Protected Pages in C#
System.Net.WebRequest can be used to download a web resource in .Net code. Following is code to download a web resource in code:
String url = "http://domain.com/resource_url"; HttpWebRequest req = HttpWebRequest.Create(url) as HttpWebRequest; WebResponse resp = req.GetResponse(); Stream Answer = resp.GetResponseStream();
This code works okay if the web resource is not protected and is public-ally accessible. But if the resource is protected using windows authentication, the code req.GetResponse() will return an Unauthorized exception.
To access a protected resource, we will need to use NetworkCredentials for the web request as shown in the following code:
String url = "http://domain.com/resource_url"; String user = "window_auth_username"; String pwd = "window_auth_password"; HttpWebRequest req = HttpWebRequest.Create(url) as HttpWebRequest; req.PreAuthenticate = true; //Tell the server that request is authenticated req.Credentials = new NetworkCredential(user, pwd, "http://domain.com"); //Link the credentials //Remaining code will remain the same. WebResponse resp = req.GetResponse(); Stream Answer = resp.GetResponseStream();
How to Create BlogEngine.Net Extensions
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:
SendCommentMailToPostAuthor–BlogEngine.Net Extension
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.
Integrating FCKeditor with BlogEngine.Net
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
- This integration is done by making changes to BE core, this will create problems in version upgrades.
- TinyMCE is fully XHTML compliant, but for FCKeditor no such claim can be made.
Create DNN Schedule in Code
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 =
DotNetNuke.Services.Scheduling.SchedulingProvider.Instance().AddSchedule(item);

