locked
'Unauthorized access error:401' while using Web Service Method RRS feed

  • Question

  • Hi,

    I am using the below method (using Web Service) to resolve an User in Infopath Form.

    string role = string.Empty;

    XPathNavigator nav = this.DataSources[DATA_USERROLESRESOLVE].CreateNavigator();

    nav.SelectSingleNode(XPATH_USERQ, this.NamespaceManager).SetValue(GetCurrentUsername());

    this.DataConnections[DATA_USERROLESRESOLVE].Execute(); //I think this is the point of error

    XPathNavigator node;

    node = nav.SelectSingleNode(XPATH_USERROLESRESOLVE + string.Format(XPATH_USERROLESUFFIX, ROLE_GROUP), this.NamespaceManager);


    But when I open the InfoPath form, and call the above method to resolve an user, I am getting below error message. The code is working fine in Local as usual, but in remote servers. Please help to fix this. Thanks in Advance.

    Details of Error 

    IsUserInGroupWeb <br>System.Net.WebException: The remote server returned an error: (401) Unauthorized. --->

    Friday, March 12, 2010 1:40 PM

Answers

  • InfoPath Form Services uses the AppPool Id to connect to resources.  I would recommend calling the WebService directly from code and not as a DataSource.  This will allow you to pass the System.Net.NetworkCredentals to the web service. before you call your function.

    Dennis
    Tuesday, March 16, 2010 1:12 AM