如何将特殊字符作为URL中的参数之一传递。 [英] How to pass special character as one of the parameter in URL.?
问题描述
如何将特殊字符作为URL中的参数之一传递。?
并使用GET方法在休息客户端访问它
我尝试了什么:
我的剧本
< script>
类型:GET;
网址:http:// localhost:24844 / CustomerService .svc / AuthenticateUser /+ $('#sender-email')。val()+/+ $('#user-pass')。val();
ContentType:application / json; charset = utf-8;
数据类型:json;
ProcessData:true;
< / script>
服务
[OperationContract]
[WebInvoke(方法=PUT) ,ResponseFormat = WebMessageFormat.Json,RequestFormat = WebMessageFormat.Json,UriTemplate =AuthenticateUser)]
用户V alidateUser(User _objUser);
('#sender-email')。val()+/+
('#user-pass')。val();
ContentType:application / json; charset = utf-8;
数据类型:json;
ProcessData:true;
< / script>
服务
[OperationContract]
[WebInvoke(Method =PUT,ResponseFormat = WebMessageFormat.Json,RequestFormat = WebMessageFormat.Json ,UriTemplate =AuthenticateUser)]
用户验证用户(用户_objUser);
尝试使用
1. encodeURI() [ ^ ]
2. decodeURI() [ ^ ]
示例:
网址: encodeURI ( http:// localhost:24844 / CustomerService.svc /的authenticateUser /跨度> +
How to pass special character as one of the parameter in URL.?
and access it in rest client using GET Method
What I have tried:
my script
<script>
Type : "GET";
Url : "http://localhost:24844/CustomerService.svc/AuthenticateUser/"+$('#sender-email').val() +"/"+ $('#user-pass').val();
ContentType : "application/json; charset=utf-8";
DataType : "json";
ProcessData : true;
</script>
service
[OperationContract]
[WebInvoke(Method = "PUT", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, UriTemplate = "AuthenticateUser")]
User ValidateUser(User _objUser);
('#sender-email').val() +"/"+
('#user-pass').val();
ContentType : "application/json; charset=utf-8";
DataType : "json";
ProcessData : true;
</script>
service
[OperationContract]
[WebInvoke(Method = "PUT", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, UriTemplate = "AuthenticateUser")]
User ValidateUser(User _objUser);
Try using
1. encodeURI()[^]
2. decodeURI()[^]
Example:
Url : encodeURI("http://localhost:24844/CustomerService.svc/AuthenticateUser/"+
这篇关于如何将特殊字符作为URL中的参数之一传递。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!