Archive for the ‘’ Category

How to avoid “The web server process that was being debugged has been terminated by IIS”

March 22, 2012 2 comments


When debugging by attaching w3wp.exe process, you often will see encounter the following error message, the web server process that was being debugged has been terminated by IIS.


This caused Internet Information Services (IIS) to assume that the worker process had stopped responding. Therefore, IIS terminated the worker process.


1. Open IIS manager.

2.Click application Pools>>select the application pool associated with the site>>and click Advanced Settings

3. Click Advanced Settings of the application pool and set the Ping Enabled property from True to False.

Now, reattach the process from Visual Studio, you should not get the error message.



Categories:, Debugging Tags: , , ,

The location of Temporary ASP.NET Files

March 18, 2012 Leave a comment

Sometimes iisreset does not remove the handle to an old dlls, you need to remove all files from the Temporary ASP.NET Files.It is located at

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files

Create an Gridview with Checkbox in each row

June 16, 2011 Leave a comment

One of the frequent requirements for Gridview is to add a checkbox for each row and a checkbox to select all the items like the Gridview below. This can be easily achieved by using jQuery. You can find the complete source code here.

$(document).ready(function () {

$(‘input[name$=”CDSelectAll”]’).click(function () {

if ($(this).attr(“checked”)) {

$(‘input[name$=”CDSelect”]’).attr(‘checked’, ‘checked’);

} else {





Updated 15 July 2011:

In the new release of  version 1.6.2 , it supports a new method called prop, you can use a new way to achieve the same thing as follow:

function ToggleAllCDs() {
$(‘input[name$=”CDSelectNew”]’).prop(“checked”, $(‘[name$=”CDSelectAllNew”]’).prop(“checked”));

$(document).ready(function () {

You can find the updated source code here.


Minimise SQL injection in

January 30, 2010 Leave a comment

According this blog,SQL injection still accounts for a large number of attacks.Here are three things you can use to prevent SQL injection.
1.Use a least-privileged database account.

2.Constrain and sanitize user input(client and server validation).

3.Use parametrized SQL statements instead of dynamic SQL

Most importantly , you need to know how the hacker to hack your site a.k.a have a hacker-mindset as a programmer when you do you job.

Categories:, SQL Server

Trigger partial postback from javascript

November 6, 2009 Leave a comment

Sometimes you would like to use javascript to trigger partial postback instead using a button click event.Here is how you do it. You can use the __doPostBack(case sensitive) to trigger a postback , if the target is an update panel ,the will intercept the request and trigger an partial postback instead.The Gotcha here is that you need to use UpdatePanel’s ClientId(which is automatically generated) rather than the UpdatePanel server side ID.
You put the following code in the markup.What you normally do is you put a button with
click event.And add a trigger in the update panel with Button ID.What I do here is that
I add a OnLoad event to the update panel and I use div’s onclick event to trigger a partial update.
You can change the javascript onclick event to any valid javascript
event to invoke the partial postback.

<asp:scriptmanager ID="myScriptManager" runat="server"></asp:scriptmanager>
 <div id="Container" onclick="__doPostBack('<% = myUpdatePanel.ClientID %>', '');">
 <asp:UpdatePanel runat="server" ID="myUpdatePanel" OnLoad="myUpdatePanel_Load">
 <asp:Literal runat="server" ID="myLiteral"></asp:Literal>
 <asp:Literal runat="server" ID="timeLiteral"></asp:Literal>
You put the following code in the code behind.
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { myLiteral.Text = "First Request"; timeLiteral.Text = DateTime.Now.ToString(); } } protected void myUpdatePanel_Load(object sender, EventArgs e) { if (IsPostBack) { myLiteral.Text = "Partial Post back"; timeLiteral.Text = DateTime.Now.ToString(); } }

You can download the code sample from here.

Categories: AJAX,

DNN Module Deployment considerations

September 28, 2009 2 comments

AJAX Control Toolkit has two Versions 3.0.30512 and early version 1.0.20229.Two problems might occur after deployment.Assume I have a module with the latest version of AJAX Control Toolkit Version 3.0.30512 and there is an existing module with with the early version of AJAX Control Toolkit Version 1.0.20229 (The DNN(4.9.2) I am using has the AJAX Control Toolkit version 1.0.20229 in the bin folder.)

Assembly Files being deleted
After you install your module, the latest version of AJAX Control Toolkit Version 3.0.30512 will be copyed into Bin directory(overwrite the existing one if any) ,everything works fine until they delete a module which use AJAX Control Toolkit ,then the AJAX Control Toolkit dll will be deleted(if they tick deleted files when deleting module) and our module will stop working.

Assembly Versions conflict
After you install your module,the latest version of AJAX Control Toolkit Version 3.0.30512 will be copyed into Bin directory(overwrite the existing one if any) ,everything works fine until site admin upgrade a module which use the early version of AJAX Control Toolkit ,then the AJAX Control Toolkit dll will be overwrite to the previous version and your module will stop working.

If we can put AJAX Control Toolkit dll into Global Assembly Cache,it will solve the problem.However if this is not feasible ,then you need to document of version of the assembly and let the site admin be aware of version of the assembly.

kick it on

Categories:, DotNetNuke

Start your DotNetNuke Module Development.

September 27, 2009 1 comment

Here is the step to start DNN Module Development using C#
1.Install DNN starter kit for DNN Module Template
2.Create a new project (Select DotNetNuke Compiled Module template) and change the project location to {DotNetNukeRoot}\DesktopModules,you need to untick the create directory for solution option.The reason for that is that when you compile your project,the compiled dll have to go to [DotNetNukeRoot]/Bin folder ,the default DNN Module template project has the build setting to output the dll to ..\..\bin\.If you tick the create directory for solution option,the dll will not be able to make it to the [DotNetNukeRoot]/Bin folder
3.Once you create the module ,you need to change the assembly name and default name space according to your project or you could go to
AssemblyInfo.cs to change it.
4.Since the default targeted .NET Version is 2.0,you might want to change this to .NET 3.5.There is Gotcha when you change the targeted framework to .NET 3.5,it will add a web.config into your project.You will get the following error if you install your module to DNN now.I nomrally just delete the web.config to make it work,not sure it is best thing to do but it works.The web.config is also added if you drag a ajax control toolkit control from the tool box the first time and the same fix apply.There is another Gotcha waiting for you if you delete the web.config.Since you are compiling your module in .Net 3.5, but the DotNetNuke core in older version is not.You need to add assemblyBinding in your site web.config file.

<assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>
<assemblyIdentity name=”System.Web.Extensions” publicKeyToken=”31bf3856ad364e35″/>
<bindingRedirect oldVersion=”″ newVersion=”″/>
<assemblyIdentity name=”System.Web.Extensions.Design” publicKeyToken=”31bf3856ad364e35″/>
<bindingRedirect oldVersion=”″ newVersion=”″/>

5.Sometimes the newly created Module does not have the correct references path for DotNetNuke.dll and Microsoft.ApplicationBlocks.Data.Dll,you can find the dlls from {DotNetNukeRoot}\Bin
6.Delete all the code in page_load and other events which are not requried(what I normally do) or you can run the sql script and then build your solution if no errors you are ready to start your DNN Module Development. 🙂

kick it on

Categories:, DotNetNuke