(Wade Mascia [MS])
1/13/2003 8:57:00 PM
You can programmatically check using User.IsInRole, or declaritively using
PrincipalPermission attribute. You can define your own roles (Q306590) or
use Windows Groups. The following WebMethods will either return "True", or
will throw a SecurityException. Note the use of "BUILTIN" when needed.
[WebMethod, PrincipalPermission(SecurityAction.Demand, Role="BUILTIN\\VS
Developers")]
public string Test1()
{
return User.IsInRole("MACHINENAME\\VS Developers").ToString();
}
[WebMethod, PrincipalPermission(SecurityAction.Demand,
Role="BUILTIN\\Administrators")]
public string Test2()
{
return User.IsInRole("BUILTIN\\Administrators").ToString();
}
HTH,
~Wade Mascia, MCSD
Developer Support Engineer - WebServices, EnterpriseServices, MTS,
COM+, ASP/COM
Microsoft Corporation
And now, a word from our lawyers: "This posting is provided 'AS IS' with
no warranties, and confers no rights."
--------------------
| Content-Class: urn:content-classes:message
| From: "Dean Bates" <dbates@vector-networks.co.uk>
| Sender: "Dean Bates" <dbates@vector-networks.co.uk>
| Subject: WebMethod Security
| Date: Sat, 11 Jan 2003 11:20:53 -0800
| Lines: 6
| Message-ID: <2f1801c2b9a6$8f2aed20$d6f82ecf@TK2MSFTNGXA13>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcK5po8qkyevm03cS9avVXhDPYIwjw==
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
| Path: cpmsftngxa09!cpmsftngxa10!cpmsftngxa06
| Xref: cpmsftngxa09
microsoft.public.dotnet.framework.aspnet.webservices:14750
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
|
| Can different WebMethods in a single Web Service be
| authenticated separately with Windows security?
|
| Any exmaples available?
|
| Many thanks
|