ASP.Net MVC 5 redirecting to /Account/Login

I recently upgraded an ASP.Net project from MVC 3 to MVC 5, but wanted to keep our old login mechanism. However, when trying to access a restricted page, I was always redirected to /Account/Login instead of /Account/LogOn. I had already met that problem with MVC 3 and thus I had added the following line in my Web.config […]

Continue reading

Could not load file or assembly ‘PresentationCore’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

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 […]

Continue reading

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 = […]

Continue reading

Duplicate a database with SQL Server Express 2008

Following my previous post, here is the same script for SQL Server Express 2008: USE master GO — the original database (use ‘SET @DB = NULL’ to disable backup) DECLARE @DB varchar(200) SET @DB = ‘MyDB’ — the backup filename DECLARE @BackupFile varchar(2000) SET @BackupFile = ‘c:\temp\mydb.dat’ — the new database name DECLARE @TestDB varchar(200) […]

Continue reading

Duplicating a database in SQL Server Express

With SQL Server Standard Edition and above, it is easy to copy a database. You simply have to right-click on its name, select Tasks and select Copy Database… However that menu item is not there in SQL Server Express. Googling for a solution, I found a script that does just that, but it was written […]

Continue reading

iSync disappeared in OS X Lion

I was really pissed when I realized that iSync had disappeared after upgrading to OS X Lion. Suddenly, I had no mean to synchronize my cellular phone with my computer. I find this type of attitude very rude from Apple. Well, by chance I did not really upgrade. In fact, I installed OS X Lion […]

Continue reading

Permission problem to run msdb.dbo.sp_send_dbmail

I needed to be able to send emails from a stored procedure using something like EXECUTE msdb.dbo.sp_send_dbmail @recipients=’address@domainname.com’, @subject = ‘Test email’, @body = ‘Test email body’ The solution was to add the user I was using to run the above query to the msdb database and to assign the role DatabaseMailUserRole to the user: […]

Continue reading

Unable to turn on or off AirPort solved

Recently, I was unable anymore to turn off AirPort on my Macbook Pro. Other people reported having the same problem, and it seems related to Snow Leopard. Some people had the reverse problem: They were not able to turn on AirPort. Here is the solution that worked for me: Open the following folder: /Library/Preferences/SystemConfiguration Delete these […]

Continue reading