In order to get started with Windows Identity Foundation, you will first need to have either Visual Studio 2008 or Visual Studio 2010 installed.
After that, you can download the Windows Identity Foundation Runtime as well as the Windows Identity Foundation SDK from these locations:
Windows Identity Foundation Runtime: http://support.microsoft.com/kb/974405
Windows Identity Foundation SDK: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c148b2df-c7af-46bb-9162-2c9422208504&displaylang=en
Unfortunately, since most Windows Identity Foundation code samples were originally created for Visual Studio 2008, I will be using Visual Studio 2008 throughout this post. Perhaps in a later post, I will be able to provide details using Visual Studio 2010.
- First of all, create a new ASP.Net Web Application
- File menu-->New Project
- Visual C#-->Web
- ASP.Net Web Application
- Make sure the .Net Framework 3.5 is selected as the Target Framework
- Specify a name and location for the new Web Application and click OK
- By default, once the new Web Application is created, Visual Studio will create it using the built-in Visual Studio Web Server. Unfortunately, because of the configuration of dynamic ports, this will cause problems later in the usage of the Web Application in conjunction with Windows Identity Foundation. Therefore, we will have to change the settings of the Visual Studio Web Application.
- Right click on the Visual Studio project and select Properties
- Select Web in the left hand navigation
- Select the radio button for Specific Port
- Enter a port number of your choosing
- Enter a Virtual Path of your choosing or leave it at the default virtual path (/). NOTE: You should be aware of this setting as this will affect the Application URI you enter in the Federation Utility wizard.
- Click on the Save button to save your project changes
- Right click on the ASP.Net Web Application and select "Add STS Reference"
- This will open the Federation Utility Wizard
- The Wizard will automatically populate the Application Configuration location with the current Web Application's web.config file path
- For the Application URI, enter the Url that you entered earlier into the Web Settings for the ASP.Net Web Application project (ex: http://localhost/WIFWebAppSample)
- If you receive a prompt regarding not being hosted on a secure https connection, click Yes.
- The next screen will now ask about creating an STS. Since you do not already have an STS available, select the option for "Create a new STS project in the current solution"
- You will now see a Summary screen displaying the various changes that will be made to support the STS.
- Click the Finish button
- The Visual Studio solution will now also include an ASP.Net Web Site project appended with an STS suffix (such as WIFWebAppSample_STS)
- As was the problem with the original ASP.Net Web Application, Visual Studio by default will use the built-in Visual Studio Web Server and therefore attempt to use dynamic ports. This will cause issues with the reliable use of the ASP.Net Web Application in conjunction with the STS.
- Select the STS project in Visual Studio
- View the Properties for the Visual Studio STS Web Site project
- Change the selection for Use dynamic ports to false.
- Save the changes
- Now, right click on the Default.aspx page for the original ASP.Net Web Application (WIFWebAppSample) and View in Browser
- You should now be redirected to the Login.aspx page found in the ASP.Net Web Site STS (WIFWebAppSample_STS)
- Click on the Submit button and you should be redirected back to your original ASP.Net Web Application Default.aspx page.
- Congratulations, you have just completed your preliminary setup using Windows Identity Foundation!
No comments:
Post a Comment