WP7 Client Certificates Part 1 (Setting Up IIS Express)

by JasonRShaver 28. September 2011 13:39

This post is part of a series on using client certificates in Windows Phone 7.  I expect there to be 3 parts involved:

  1. Setting Up IIS Express
  2. Client Certificates on the Browser
  3. Client Certificates on the Emulator
  4. Client Certificates on the Phone

Setting Up IIS Express

Create a new ASP.NET MVC 3 Web Application project

image

And select Internet Application with the default settings

image

Now to work with SSL, we need to use either IIS or IIS Express, and since I seem to make new applications every 15 minutes, I figure this is a good chance to get familiar with IIS Express.  The first step is to install IIS Express via the Web Platform Installer by following this link.  Once you are done clicking on a few accept/allow dialogs and clicking on the final Install button, wait for the install to finish and then restart Visual Studio 2010.

Right click on your web project and select “Use IIS Express”

image

and click Yes on the following dialog:

image

and note the address given at the next dialog:

image

Now to enable SSL, click on your project, pull up the Properties panel (F4) and set SSL Enabled to True.

image

And again, note the SSL URL which should be something like https://localhost:44300.  Lets set that as the default URL for our debugging.  Right click on the web project and select properties.  Go to the Web tab and update the Project Url under Use Local IIS Web server.

image 

Now, you should be able to F5 your project.  A security validation error will come up, if you click on the scary looking “Continue to this website (not recommended)”, you should see your website come up normally.

imageimage

Trusting Your Self Signed Certificate

So, now we are in the realm of security and certificates.  Lets start by telling our development machine to trust the SSL self-signed certificate that gets automatically created by IIS Express.  Click on Start, type ‘mmc’ and run the mmc.exe application.  Click File, and select Add/Remove Snap-In….  Double-click on Certificates and select Computer Account when the Certificates snap-in dialog pops up and click next.  On the next dialog, Local Computer should be selected and click Finish.

image

The resulting screen should look like this:

image

and after selecting OK, expand the Certificates (Local Computer) node on the left, and the Certificates node underneath that.  Find the localhost certificate issued by localhost.  Drag that certificate to the Trusted Root Certification Authorities node.  The result should look like this:

image

Now, lets go back to our web application and F5 our application again.  If everything went well, the web page should come right up without any errors and the address bar should no longer be a scary red:

image

Quick recap, where are we right now.  We have a web application, using SSL via IIS Express with a trusted self-signed certificate.  Let’s take this the next step, using self-signed client certificates.

Tags: , , , , ,

Blog

About the author

I am a software developer working for Microsoft in Redmond, WA.  In addition, my wife and I own TTXOnline, what is likely the 3rd largest table tennis store in the US.

Month List

Page List