R
Richie
I am having trouble calling a web service from an Windows Form that is
launched from an Infopath form. (All coding done in C#) The windows
form is launched during the Infopath form's OnLoad event. The web
service is running locally. When I run the infopath form from
VisualStudio, everything works fine, and the web service returns the
proper results. However, if I open the infopath template on its own i
get an error:
System.Security.SecurityException: Request for the permission of type
System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed.
My web service is running on IISv5.1, and the Directory Security ->
Authentication is set up with only Basic Authentication checked, and
both Default domain and Realm defined. I cannot have Integrated
Windows Authentication b/c i am calling Active Directory in the web
service (although i am testing on a web service that does not call
active directory).
The pertinant code in my windows form is as follows:
--------------
using APR_form.localhost1; //web reference to my web service
ADwebService getEmployees = new ADwebService();
System.Net.NetworkCredential nc = new
System.Net.NetworkCredential("<username>","<password>", "<domain>");
getEmployees.Credentials = nc;
XmlNode empsNode = getEmployees.getAllEmployees();
--------------
If my code does not contain the 3 Credentials lines, it will get the
following authentication error when running from VisualStudio:
System.Net.WebException
The request failed with HTTP status 401: Access Denied.
So my problem is, how do i properly authenticate to call the web
service given my IIS setting restrictions?
Please help!?!
launched from an Infopath form. (All coding done in C#) The windows
form is launched during the Infopath form's OnLoad event. The web
service is running locally. When I run the infopath form from
VisualStudio, everything works fine, and the web service returns the
proper results. However, if I open the infopath template on its own i
get an error:
System.Security.SecurityException: Request for the permission of type
System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed.
My web service is running on IISv5.1, and the Directory Security ->
Authentication is set up with only Basic Authentication checked, and
both Default domain and Realm defined. I cannot have Integrated
Windows Authentication b/c i am calling Active Directory in the web
service (although i am testing on a web service that does not call
active directory).
The pertinant code in my windows form is as follows:
--------------
using APR_form.localhost1; //web reference to my web service
ADwebService getEmployees = new ADwebService();
System.Net.NetworkCredential nc = new
System.Net.NetworkCredential("<username>","<password>", "<domain>");
getEmployees.Credentials = nc;
XmlNode empsNode = getEmployees.getAllEmployees();
--------------
If my code does not contain the 3 Credentials lines, it will get the
following authentication error when running from VisualStudio:
System.Net.WebException
The request failed with HTTP status 401: Access Denied.
So my problem is, how do i properly authenticate to call the web
service given my IIS setting restrictions?
Please help!?!