This project is read-only.
While developing a HealthVault integrated application using the .Net SDK for an online scenario, the easiest way to build an application is to derive all your HealthVault enabled pages from the HealthServicePage class. But in some cases it will not be possible for the web pages to derive from HealthServicePage as the child page has to derive from some application specific base class (for example some SharePoint pages must be derived from SharePoint.WebControls). If the child page does not derive from HealthServicePage then it looses the authentication and authorization code that are available as part of the HealthServicePage and the authorization and authentication procedure will have to be taken care of in the application itself.

This sample application will demonstrate how to develop an Online HealthVault application without deriving the HealthVault pages from HealthServicePage. All the authorization code is written in the site pages directly. Once the authorization is done the person information will be saved in a cookie for later use. The algorithm below describes this process:

1. Verify whether the user’s person information is already saved in a cookie. If yes go to step 6.
2. If not redirect the user to the login page.
3. Once the platform returns control to the Action URL, get the authorization token from the query string parameter.
4. Get the person information.
5. Save the person information in a Cookie.
6. Read data from HealthVault by retrieving the person information from the Cookie.

In this sample, the Action URL is a separate page from the default page to make it more visible. You can see that the above algorithm is implemented in the OnPreLoad() method in the class Default in Default.aspx.cs file and the PageLoad() method in the class TrialRedirect in Redirect.aspx.cs file.

How to Run:

The solution is developed in Visual Studio 2008.

1. Extract the solution and open it as a web site in Visual Studio.
2. Create a new application ID (See if you don't have one already.
3. Replace the "value" field of the "ApplicationId" key in the Web.config with your application ID from Step 2.
4. Replace the "value" field of the "ApplicationCertificateFileName" key in the Web.config with the path to the application certificate from step 2.

Last edited Jan 24, 2011 at 8:47 PM by aneeshdk, version 3