views:

45

answers:

4

How do I configure .NET webservice to require all consumers to supply credentials, then verify their validity against database table?

A: 

Lots of ways to do this.

Have a look at the SoapHeader class for one - there is a sample here.

Chris Diver
A: 
Adam
+2  A: 

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.

Justin Niessner
Isn't WSE 3.0 just for .NET 2.0?
Sphynx
SOAP headers not supported on other platforms other than .NET, are you sure???
Chris Diver
@Chris Diver - They may be supported, but they don't conform to the standard for Web Service Interop so it's not guaranteed.
Justin Niessner
@Justin - but they conform to the standard of SOAP web services.
Chris Diver
@Sphynx - WSE 3.0 is only supported for Visual Studio 2005, correct. If you're using Visual Studio 2008, Microsoft advocates migrating to WCF if you need the added functionality.
Justin Niessner
Thanks Justin, I've switched to WCF.
Sphynx
A: 

Looks as if you could do worse than read:

http://progtutorials.tripod.com/Authen.htm

"Forms Authentication".

PolicyWatcher