我有一个网络服务,例如
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class SI_C : System.Web.Services.WebService {
public SI_C()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[Webmethod]
public bool CreateRecord(classname objname) //some class I am setting the data to
{
//Creates a record.
}
}
现在在我创建的客户端上消费时
SI_C_In_SoapClient client = new SI_C_In_SoapClient("SI_C");
client.ClientCredentials.UserName.UserName = "Username Sent";
client.ClientCredentials.UserName.Password = "Passport Sent";
现在,我想在我的Web服务中访问此发送的密码和用户名。我该怎么办?
查看CredentialCache.DefaultNetworkCredentials
,这是链接: