我如何访问用户在调用Web服务时设置的Web服务凭据?

问题描述 投票:0回答:1

我有一个网络服务,例如

[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服务中访问此发送的密码和用户名。我该怎么办?

c# asp.net soap asmx soap-client
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.