Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to execute web service with declarative security

Status
Not open for further replies.

JediDan

Programmer
May 15, 2002
128
0
0
US
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:
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top