Rename cookie

You can adjust it in your web.config file, the default is ASPXAUTH:

   <authentication mode="Forms">
      <forms name=".CRM-Cookie" loginUrl="LoginPage.aspx" />

This is useful when running multiple applications from the same server under the same domain. 

IIS Express Configuration File

The configuration file is called applicationhost.config It’s stored here:

My Documents > IIS Express > config

usually (not always) one of these paths will work

%userprofile%\my documents\iisexpress\config\applicationhost.config

Update for VS2015

If you’re using visual studio 2015 look here:
$(solutionDir)\.vs\config\applicationhost.config MVC $.ajax performing full post back on button click

One of the biggest mistakes when attaching an html button to an ajax request is not declaring the button type. By default html buttons will submit the entire form, which is not what we want with an ajax request. To prevent this happening make sure button has a type of button e.g.

The following will result in a full post back after executing the AjaxCall JavaScript function.

<button onlick=”AjaxCall()”>Click me</button>

However this will run the AjaxCall JavaScript function but not perform a full post back.

<button type=”button” onlick=”AjaxCall()”>Click me</button>

Debugging MVC web applications

There are two very useful helpers which accompany MVC.


Adding @ServerInfo.GetHtml to your cshtml file will output detailed information about IIS and configuration and variables.


Passing an object to the ObjectInfo help will display the types and variables of the objects properties. In its simplest form use @ObjectInfo.Print(object)

Determining the Exchange Web Services (EWS) URL for authentication

I’ve recently had to write an application which provides Exchange integration for booking meeting rooms. Microsoft provide the Exchange Web Services Management API for use with Exchange 2007 and above. This provides a nice API to performing the usual Exchange functions such as managing inbox’s and calendars.

Before the API can talk to Exchange it requires a connection URL. Microsoft recommend using the Exchange’s Auto Discovery function, however if you want to specify this manually the below will help you find the correct URL.

The Exchange admin can use a PowerShell command on the exchange server

a. Open PowerShell on the Exchange server
b. Type Get-WebServicesVirtualDirectory |Select name, *url* | fl
c. The URL will be provided

Use the Outlook 2007 or 2010 Auto Discovery feature

a. Hold the Ctrl key and right click on the Outlook Icon in the system tray (Note this must be outlook version 2007 or 2010)
b. Select “Test E-mail Auto Configuration” from the menu
c. Type in an email address located on the desired Exchange server
d. Ensure that only the “Use Auto Discover” checkbox is enabled
e. Click “Test”
f. Search the results for the line starting with “Availability Service URL” this line contains the EWS URL Caching

Using the page directive it's possible to control caching on aspx pages. Simply add the following to the top of the page where 600 is the number of seconds to cache for. There are a number of other parameters which can be added but this is the basics for simple caching.

<%@ OutputCache Duration="600" VaryByParam="None" %>

Using a Hexadecimal color instead of a System.Drawing.Color

By default most componants expect System.Drawing.Color.colour_name to be used when changing colours. However this objects also supports the FromArgb method which allows colours to be defined by RGB values. But this also allows HEX values such FFFFFF (white) to be used. The below example will  set a cell colour in a DataGrid to red where DC241f is the HEX value.

DataGrid.Item.Cells[2].BackColor = System.Drawing.Color.FromArgb(0xDC241f);