在WCF restful服务中将电子邮件Id作为参数传递

在WCF restful服务中将电子邮件Id作为参数传递,wcf,web-services,Wcf,Web Services,假设我有一个web服务,它接受电子邮件id和密码作为url中的参数。我必须通过电子邮件id和密码对用户进行身份验证使用系统;使用System.Collections.Generic;使用System.Linq;使用System.Runtime.Serialization;使用System.ServiceModel;使用系统文本;使用System.ServiceModel.Web;命名空间WebApp.Services{[ServiceContract]公共接口IService{[WebInvok

假设我有一个web服务,它接受电子邮件id和密码作为url中的参数。我必须通过电子邮件id和密码对用户进行身份验证<代码>使用系统;使用System.Collections.Generic;使用System.Linq;使用System.Runtime.Serialization;使用System.ServiceModel;使用系统文本;使用System.ServiceModel.Web;命名空间WebApp.Services{[ServiceContract]公共接口IService{[WebInvoke(Method=“GET”,UriTemplate=“/authenticate/{emailId}/{password}”,ResponseFormat=WebMessageFormat.Json,RequestFormat=WebMessageFormat.Json)][OperationContract]布尔身份验证(字符串emailId,字符串密码);}}

我们这样称呼web服务:

由于电子邮件包含“.”,而web浏览器未对其进行编码,因此不调用web服务函数

有任何解决方案可以在url中传递除查询字符串以外的电子邮件id。

如果您可以使用POST:

[ServiceContract]
public interface IMyService
{
     [OperationContract]
     bool Authenticate(EmailCredential request);
}

[DataContract]
public class EmailCredential 
{
     [DataMember]
     public string EmailId {get; set;}

     [DataMember]
     public string Password {get; set;}
}
并使用WebClient或WebHttpRequest使用该xml调用服务(我现在不知道json对于这种xml是什么样子)


苏珊特。bhatnagar@greatdevelopers.com
123

哦,这是另一种方式,但GET请求有其他方式。不幸的是,每个GET请求都会被拒绝,原因是您提到了问题:/所以我认为唯一的解决方案是POST。如果您发送电子邮件id时使用base 64编码并在服务功能中对其进行解码,则有一个选项。
    <EmailCredential >
        <EmailId >sushant.bhatnagar@greatdevelopers.com</EmailId >
        <Password >123</Password >
    </EmailCredential >