Webservice authentication using Soap Headers

Webservice authentication using Soap Headers


public AuthInfo Ainfo;

public DataSet GetEmpDetails(string EID)
DataSet dsEmpDetails = null;
Ainfo.MustUnderstand = true;
if(Ainfo.Uname=="ravi" && Ainfo.pwd=="ravi")
Ainfo.DidUnderstand = true;
string sCon = "server=; database=testdatabase; UID =sa;pwd=sa;";
dsEmpDetails = SqlHelper.ExecuteDataSet(sCon, "Ps_GetEmpDetl", EID);
return dsEmpDetails;
Ainfo.DidUnderstand = false;
return dsEmpDetails;

// This Class is used to Add the Soap Header to the webservice

public class AuthInfo:SoapHeader
public string Uname;
public string pwd;

Aspx File:

localhost.AuthInfo oAuthInfo = new eNotepad.localhost.AuthInfo();
localhost.EmpDetails oEmpDet = new eNotepad.localhost.EmpDetails();
oAuthInfo.Uname = "test";
oAuthInfo.pwd = "test";
oEmpDet.AuthInfoValue = oAuthInfo;
DataSet ds = oEmpDet.GetEmpDetails(txtUserId.Text);


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: