locked
Getting Excption:Access is denied while using OfflineWebApplicationConnection RRS feed

  • Question

  • Hi,

    I am getting an error Access is denied while using below code:

                 string appid = WebConfigurationManager.AppSettings["ApplicationId"];
                    Guid _Guid = new Guid(appid);
                    OfflineWebApplicationConnection owac = new OfflineWebApplicationConnection(_Guid,  WebApplicationConfiguration.HealthServiceUrl, Guid.Empty);

                    owac.Authenticate(); 

    I have created an offline rule. My application Id: d6fa2321-a038-497c-a334-a50b0396036c

     Please help me if i am doing anything wrong.

     

    Tuesday, November 30, 2010 11:27 AM

Answers

  • The constructor that you are using is used to create an offline connect that will allow the application to access the records authorized by a specific person. The third parameter is a person id, and since Guid.Empty isn't a valid person id, you get access denied.

    I'm sorry the error isn't more useful; for security reasons there are a lot of cases where you just get an "access denied" back.

    You will need to get a person id that you can use. You can do this through a web application using the same application id, or through the patient connect model.

    Thursday, March 10, 2011 5:37 PM

All replies

  • Hello ,

    I have verified your application in our admin tool and i have observed that you have added offline rules for this application id but you have not added the same online rules for this application Id.  You need to set up rules to allow access for both online and offline modes.

    Open the Config center

    1, Click on the application created by you.
    2, Go to the OnLineAccess tab, Add Rule and give all permissions.
    3, Go to the OfflineAccess tab, Add Rule and give all permissions.

    In offline connection scenario the application will run in online mode, authorize a record to that application, and then the application saves the record id and person id and associates it with that user. The record and app id are per-application.  By using the PersonId and RecordId you should be able to create an offline connection and access that record. 

    Please look into this URL for more information .

    Hope this helps.

    Regards,

    Madan Kamuju

    • Proposed as answer by Madan kamuju Wednesday, December 1, 2010 3:40 PM
    Tuesday, November 30, 2010 2:28 PM
  • Hello ,

    In Offline scenario you don't need add online rules now and you can run your application with offline rules only. Please let me know if you have any issues.

    Regards,

    Madan Kamuju

    Wednesday, March 9, 2011 5:56 PM
  • The constructor that you are using is used to create an offline connect that will allow the application to access the records authorized by a specific person. The third parameter is a person id, and since Guid.Empty isn't a valid person id, you get access denied.

    I'm sorry the error isn't more useful; for security reasons there are a lot of cases where you just get an "access denied" back.

    You will need to get a person id that you can use. You can do this through a web application using the same application id, or through the patient connect model.

    Thursday, March 10, 2011 5:37 PM