Posted on: 2/27/2014 7:45:15 PM | Views : 635

Hi,
I am trying to implement webservice authentication using SOAP Header. I know how to achieve this. i have a requirement about how to provice single authentication which applied to all the methoads of webservice.

Example : 
public class Service:System.Web.Services.WebService { public AuthSoapHd spAuthenticationHeader; public Service() { } public class AuthSoapHd: SoapHeader { public string strUserName; public string strPassword; } [WebMethod,SoapHeader("spAuthenticationHeader")] public string HelloWorld() { if (spAuthenticationHeader.strUserName =="TestUser" && spAuthenticationHeader.strPassword =="TestPassword") { return "User Name : " +spAuthenticationHeader.strUserName + " and " + "Password : " +spAuthenticationHeader.strPassword; } else ...

Go to the complete details ...