Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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);
Posted
Updated 10-Jul-16 22:29pm
v2
Comments
Karthik_Mahalingam 11-Jul-16 4:26am    
are you facing any issue?
any error message?
Gayathri Reddy 11-Jul-16 7:16am    
yes getting bad request
Karthik_Mahalingam 11-Jul-16 8:12am    
if you pass some other value, are you getting the error ?
Gayathri Reddy 12-Jul-16 0:36am    
no . when i try to pass mail id / password along with special characters then only i get this bad request

1 solution

Try using
1. encodeURI()[^]
2. decodeURI()[^]

Example:
JavaScript
Url : encodeURI("http://localhost:24844/CustomerService.svc/AuthenticateUser/"+$('#sender-email').val() +"/"+ $('#user-pass').val());


Hope, it helps :)
 
Share this answer
 
Comments
Gayathri Reddy 11-Jul-16 7:18am    
sorry giri .thanks for the reply ,
it is not working .give me some other soln if u know
Suvendu Shekhar Giri 11-Jul-16 7:25am    
Is it giving any error?
Can you please explain what issue you are facing implementing this?
Gayathri Reddy 11-Jul-16 7:54am    
getting bad request
this is my original url
http://localhost:24844/CustomerService.svc/AuthenticateUser/jack/UlTEC9*97x_H1@
encode url
http://localhost:24844/CustomerService.svc/AuthenticateUser/jack/UlTEC9*97x_H1@

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900