Microsoft.Health.HealthServiceAccessDeniedException: Access is denied. StatusCodeId = 11

Unanswered Microsoft.Health.HealthServiceAccessDeniedException: Access is denied. StatusCodeId = 11

  • Monday, July 02, 2012 2:53 PM
     
     

    Hi,

    I am developing the registration work flow where i can upload the demograhpics for that patient and ask permisssion for access to his healthvault account. It was working fine.. But suddenly i am getting access denied Error.  Right Now it allows access for my application but on landing page of my application where i am getting an errorDo u have any idea why i am getting error msg?

    I tried creating another public key and upload it to the config center but still its not working.

    I am getting error on the following  bold line

    Code

    string url = Request.QueryString["ReturnUrl"];

                        string[] values = url.Split('?');
                        url = values[1];
                        string path = url.Substring(url.LastIndexOf("wctoken="));
                        path = path.Replace("wctoken=", string.Empty);


                        PatientPortal.BAL.clsBALRedirect oRedirect;
                        oRedirect = new PatientPortal.BAL.clsBALRedirect();
                        string personInfoXml = path;
                        string strEmail;
                       
                        if (!String.IsNullOrEmpty(personInfoXml))
                        {
                            Microsoft.Health.PersonInfo personInfo = WebApplicationUtilities.GetPersonInfo(personInfoXml);
                            oRedirect.PersonId = personInfo.PersonId.ToString();
                            oRedirect.RecordId = personInfo.SelectedRecord.Id.ToString();
                            oRedirect.UpdateHealthvaultId(PageToXML._username);
                            Response.Redirect("~/Account/PortalHome.aspx", true);
                        }

    Error Msg.

    {Microsoft.Health.HealthServiceAccessDeniedException: Access is denied.
       at Microsoft.Health.EasyWebRequest.WaitForCompletion()
       at Microsoft.Health.EasyWebRequest.Fetch(Uri url)
       at Microsoft.Health.EasyWebRequest.Fetch(Uri url, IEasyWebResponseHandler customHandler)
       at Microsoft.Health.HealthServiceRequest.ExecuteInternal()
       at Microsoft.Health.HealthServiceRequest.Execute()
       at Microsoft.Health.PlatformPrimitives.HealthVaultPlatformPerson.GetPersonInfo(ApplicationConnection connection)
       at Microsoft.Health.HealthVaultPlatform.GetPersonInfo(ApplicationConnection connection)
       at Microsoft.Health.Web.WebApplicationUtilities.GetPersonInfo(String authToken, Guid appId)
       at Microsoft.Health.Web.WebApplicationUtilities.GetPersonInfo(String authToken)
       at PatientPortalWebRole.Account.Login.Page_Load(Object sender, EventArgs e) in C:\AHS Projects\PatientPortalAzure\WebRole1\Account\Login.aspx.cs:line 57 Microsoft.Health.HealthServiceAccessDeniedException :StatusCode = AccessDenied :StatusCodeId = 11}

     Thanks,

    Amit Borse


    • Edited by Writepad Monday, July 02, 2012 3:03 PM
    •  

All Replies

  • Monday, July 02, 2012 6:51 PM
     
     

    You shouldn't need to change around your public key / cert.  Just to verify, this is a web application and the code you are showing above is running after the user has logged in to HealthVault?  After the user logs in to HealthVault we are redirecting to the registered action URL you have specified for your application.

    Also looking at the above code, it looks like the URL that was hit redirected somewhere else and the URL was put into a "ReturnUrl" query string parameter?

    So now you have some URL like www.foo.com/account/mypage.aspx?ReturnUrl=www.foo.com/actionpage.aspx%3fwctoken%3dabcdefg...

    Assuming that the user has logged in correctly and you have a valid auth token, my assumption is that you aren't properly url decoding the string.  After you have path = path.Replace("wctoken=", String.Empty), try doing path = HttpUtility.UrlDecode(path);