大家好我是MVC3的初學者。我的問題是關於使用類。我正在使用Web服務來獲取參數在這一點上,我沒有問題,但我的問題是,我一次又一次地定義每個控制器方法中的每個連接,所以有什麼shorcut?在MVC3中使用類
下面是一個例子:
public ActionResult BeyanListe()
{
Services_building client = new Services_built();
Services client_service = new Services();
client_service.ClientCredentials.UserName.UserName = "service_test";
client_service.ClientCredentials.UserName.Password = "..";
client_service.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
client.ClientCredentials.UserName.UserName = "service_test";
client.ClientCredentials.UserName.Password = "..";
client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
return View()
}
正如你可以看到上面我已經宣佈兩次,clientcredentials