leocasep leocasep - 18 days ago 5
reST (reStructuredText) Question

REST MVC - Cant Pass # character on parameter type String

Hello I´m new on REST and I create my First REST MVC Api.
I have one method call

recibir
wich recieve one string parameter
"(string eventos)"
and when I want to pass the string
"2013-10-1117:59:59;10;0#2013-10-1118:00:00;12;0#"
on server side (Action
recibir
on my Apicontroller) only receive in eventos parameter the first part of the string passed
"2013-10-1117:59:59;10;0"
until
#
.

I dont know if I can pass the
#
but with other character I havent got any problems.

An example of a call to my rest is:

http://localhost:56010/commentApi/recibir?eventos=2013-10-1117:59:59;10;0#2013-10-1118:00:00;12;0#


And in my server side I recieve from parameter eventos
"2013-10-1117:59:59;10;0"


Thanks and excuse me because my english is not the best. =)

Answer

You have to encode the # symbol, since it is a reserved symbol in URLs.

So when creating those links, you should use something like UrlEncode.

Comments