Hello all,
I'm trying to execute a web service in a C# windows app. Without any security provisions, it works fine. However, when we switch to declarative security, we get the following SoapException: "Server was unable to process request. -> Request for principal permission failed."
The web service code:
The calling code in a Win app:
Any help is appreciated.
Thanks,
Dan
I'm trying to execute a web service in a C# windows app. Without any security provisions, it works fine. However, when we switch to declarative security, we get the following SoapException: "Server was unable to process request. -> Request for principal permission failed."
The web service code:
Code:
[WebMethod]
[PrincipalPermission(SecurityAction.Demand,Role="Manager")]
public string HelloWorld()
{
return "Hello World";
}
The calling code in a Win app:
Code:
string[] sa = new string[2];
//sa[0] = "Employee";
sa[0] = "Manager";
GenericIdentity gi = new GenericIdentity("Dan");
GenericPrincipal pp = new GenericPrincipal(gi,sa);
System.Threading.Thread.CurrentPrincipal = pp;
webserver.WSTest myService = new webserver.WSTest();
myService.Credentials = System.Net.CredentialCache.DefaultCredentials;
MessageBox.Show(myService.HelloWorld());
Any help is appreciated.
Thanks,
Dan