When freshly installing Visual Studio and using windows authentication, you typically run into the “The requested page cannot be accessed because the related configuration data for the page is invalid” error.

Before, you would go to c:\users\[yourusername]\documents\IISExpress\config\applicationhost.config and change the following section

<section name="windowsAuthentication" overrideModeDefault="Deny" />

<section name="anonymousAuthentication" overrideModeDefault="Deny" />
<add name="AnonymousAuthenticationModule" lockItem="true" />

to look like this


<section name="windowsAuthentication" overrideModeDefault="Allow" />

<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<add name="AnonymousAuthenticationModule" lockItem="false" />

Only, with Visual Studio 2015, this does not seem to work anymore. The settings file being used by IISExpress is now localized in C:\path\to\your\solution\.vs\applicationhost.config. Change this file like above, restart your project and IIS Express and you should be back on track again!

<useglobalapplicationhostfile>True</useglobalapplicationhostfile>

to your .csproj file. This way, the applicationhost.config in your documents folder will be used again.

If you want to enable spell checking when you are writing a commit message, you can add

set spell spelllang=en_us

to your .vimrc file. This file is located in your home folder, so e.g. C:\Users\itto\.vimrc.

Errors will be highlighted with a red background. Nice and easy.

When running drush you can run into this error message. In my case, the mysql command line tool provided with Mamp Pro was not available. You can easily test this by typing the command ‘mysql’ in terminal. Your output might be -bash: mysql: command not found.

To solve this, do the following in terminal:
sudo vim ~/.bash_profile
Press i
Move to the last line and append
export PATH=/Applications/MAMP/Library/bin/:\$PATH
Hit escape
Type in :wq (including the colon) to write the file and quit vim.
Reload your profile by running source ~/.bash_profile.

The mysql command AND drush should now work!

private void RestoreDatabase(String databaseName, String backUpFile, String serverName)
{
var connection = new ServerConnection(serverName);
var sqlServer = new Server(connection);
var restore = new Restore();

string pathBackupfile = Path.GetDirectoryName(backUpFile);

if (pathBackupfile != null) {
string logFile = Path.Combine(pathBackupfile, databaseName + "_Log.ldf");
string dataFile = Path.Combine(pathBackupfile, databaseName + ".mdf");

restore.Devices.Clear();
restore.Action = RestoreActionType.Database;
restore.Database = databaseName;
var bkpDevice = new BackupDeviceItem(backUpFile, DeviceType.File);
restore.ReplaceDatabase = true;

//Relocate mdf & ldf files

restore.SqlRestore(sqlServer);
}
}


I was recently writing a webapplication for one of our clients. The application is a training management tool and thus involves sending loads of e-mail. This way people get reminded that they’ll be following a training in the next days or asked to write a review about their training. To make the mail look great, we wanted it to be in HTML and contain the company logo.

A first attempt was made by just writing the html for the mail and use an ordinary image-tag with a reference to the client’s intranet (like this: <img src=”http://intranet.client.com/logo.gif”/>). However, the kick-ass intranet-security of our client wouldn’t allow this and each time the mail was opened, the user was prompted for his credentials. Very annoying! So we had to include the image in the mail as an attachment. You see it every day, but apparently the code to do this in c# isn’t that widely spread. So here’s my function to accomplish it:

/// <summary>
/// Embeds the company logo into the given mail message
/// </summary>
/// <param name="message">Message in which the logo should be embedded</param>
private static void EmbedCompanyLogo(MailMessage message)
{
AlternateView av1 = AlternateView.CreateAlternateViewFromString(message.Body, null, System.Net.Mime.MediaTypeNames.Text.Html);
string strImageUrl = System.Web.HttpContext.Current.Server.MapPath("~/images/logo_print.gif");
logo.ContentId = "companylogo";
//To refer to this image in the html body, use <img src="cid:companylogo"/>
}


As mentioned in the code comment, in your mail message you can refer to the image with a source equal to “cid:companylogo”.

If you have any thoughts, remarks or questions, the comments are open…