views:

17

answers:

0

Hi all expert, While client application call the web method with invalid username or password. Client application should get the message like "Access is denied". How can automitcally client will get the message...pls help me....here is my webmethod code:

[WebMethod, SoapHeader("spAuthenticationHeader")]

public DataSet GetCustList()

{        

    if (spAuthenticationHeader.strUserName == "TestUser" && spAuthenticationHeader.strPassword == "TestPassword")

    {

        DataSet ds = new DataSet();

        CustomerDAL Customer = new CustomerDAL();

        return Customer.GetCustomer();

    }

    else

    {

 DataSet dsError = new DataSet();

        dsError.Tables.Add(new DataTable("Errors"));

   dsError.Tables[0].Columns.Add("Error");

        DataRow dr = dsError.Tables[0].NewRow();

        dr["Error"] = "Access denied";

        dsError.Tables[0].Rows.Add(dr);

        dsError.AcceptChanges();

        return dsError;            

    }       

}