My Development Notes

By Haemoglobin
3/10/2010 (revision 1)

Web Services

%@ WebService directive instead of Page, 
[WebService] attribute above the code behind class that defines the namespace.
[WebMethod (enableSessionState, transactionOption, cacheDuration, bufferResponse)]
//Web methods must return a [Serializable] object with a default constructor.

Calling from client script

Add [System.Web.Script.Services.ScriptService] above code behind class definition. 
Ensure the ScriptHandlerFactory HTTP handler is registered for asmx files in the web.config. 
Add to the ScriptManager on the page: 
Services
    asp:ServiceReference path="MyWebService.asmx"

//Call in javascript
string result = MyWebService.MyWebMethod(); 

Security

Windows Basic AuthenticationPopup for authentication, clear text.
Windows Basic Authentication over SSLEntire communication call encrypted (slow)
Client CertificatesObtained from trusted certificate authority, certificate mapped to user.
Windows DigestSimilar to basic but sent encrypted, needs to both be on windows though.
Forms based authenticationNot supported for web services
Windows IntegratedEncrypted and automatic. Needs to be on windows though.
Custom SOAP HeadersCan be used for non-windows platforms.

Comments

Powered by BlogEngine.NET 1.6.1.0 | Design by styleshout | Enhanced by GravityCube.net | 1.4.5 Changes by zembian.com | Adapted by HamishGraham.NET
(c) 2010 Hamish Graham. Banner Image (c) Chris Gin