After copying a web site to a 64bit server with IIS 7, I was getting the following error message: Could not load file or assembly ‘PresentationCore’ or one of its dependencies. An attempt was made to load a program with an incorrect format. although everything was working fine when running the site on my machine […]
Output the call stack in C#
Here is the code I use in C# to output the Call Stack. In this example, I am using log4net to output each line in a log file, but it would be possible to use Writeln or another logging library: log4net.ILog logger = log4net.LogManager.GetLogger(“File”); logger.Debug(“Call stack:”); StackTrace st = new StackTrace(true); for (int i = […]
Multiple Nulls in a column with a UNIQUE constraint
I came accross a situation where I needed to temporarily insert multiple rows in a table with a Null value in a column with a UNIQUE constraint on it. In other words, I wanted the values in that column to be unique, except when they are Null. According to ANSI SQL specifications, this should be […]
How to sumbit a form using the Enter Key on an ASP.Net page
I am working on an application that has a search page with two buttons: one to reset the form and the other one to submit the form. The reset button also clears information kept in session. By default, the Search button has the focus on that page, but has soon as we would click on […]