binding : wsHttpBinding
security mode: Message
Client Credentials : Username
Server certificate : yes
I know how to consume from Desktop app. like...
ServiceReference1.Service1Client jc = new ServiceReference1.Service1Client ();
jc.ClientCredentials.UserName.UserName = "a";
jc.ClientCredentials.UserName.Password = "a";
jc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
Console.WriteLine(jc.GetData());
but want to know how to cosume from asp.net or MVC web app????
Thanks...
Loading
Keyur PatelPosted May 16, 2013, 3:30 AM
Once you create service client object as proxy then you can pass your username, password,certificatevalidationmode. You can consume your WCF service in MVC as in following sample. You can refer following URL.
http://msdn.microsoft.com/en-us/library/ff648840.aspx
http://blog.adnanmasood.com/2010/04/29/step-by-step-guide-for-authenticating-wcf-service-with-username-and-password-over-ssl/
http://www.codeproject.com/KB/aspnet/aspnetmvc_bugtracker_v4.aspx
=====================================
public ActionResult About()
{
ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
ViewData["result"] = proxy.GetData(4);
return View(ViewData);
}
hj hjPosted May 16, 2013, 4:26 AM