Enable authentication in ASP.NET web service
How do I configure .N开发者_JS百科ET web service to require all consumers to supply credentials, then verify their validity against database table?
If you're using class ASP.NET ASMX Web Services, I would suggest you download Microsoft's Web Service Enhancements 3.0. That will enable you to properly support WS-Security.
You could also use custom SOAP Headers, but that method doesn't conform to WS-Security standards and could cause interoperability problems if you're consuming the services from a non-.NET platform.
If you're using WCF, you just need to configure your binding to use the proper type of security. Take a look at Bindings and Security. It's a broad overview and you'll have to dig a little deeper to get the specifics for your type of binding.
Lots of ways to do this.
Have a look at the SoapHeader class for one - there is a sample here.
Looks as if you could do worse than read:
http://progtutorials.tripod.com/Authen.htm
"Forms Authentication".
精彩评论