I am using WCF / .NET 4.0 / IIS7.5 / Sever 2008
I want to do this:
http://localhost/users/email/bill@microsoft.com
But, it shows up on the server like this:
“bill”
The “@microsoft” gets removed.
I understand that the at symbol is a special case.
Is there a graceful way to do this? Can I instruct
my WebGet method that this method is going to take
a special symbol and please encode it?
[WebGet(UriTemplate = "/email/{email}")]
[WebDispatchFormatter]
[OperationContract]
UserDto GetUserByEmail(string email);
How do I manipulate email addresses using WCF REST?
Thanks.
When you use special characters in a URI, you have to URI Encode them and then decode on the service side. Since this is .NET, you can utilize the encode/decode bits for URL encoding.