简体   繁体   中英

Why escaping quote doesn't work with my webservice?

I access to my webservice like that:

It works fine, but when I try:

it failed, ok this I understand, but if I encode the url like that:

I get the error Bad Request - Error in query syntax. too

What is the solution?

The reason it's failing is because %27 is equal to '.

Everything is encoded before being sent to the web server, even if the URL box doesn't say so.

This will become hard to maintain and possibly confuse your users. I'd change it so you aren't padding the variable with ' and that way you can use http://localhost/SuiPService/SuiPDataService.svc/GetShowCodeFiltered?&showName=auto ' if you need to have a ' after it.

Also, if you need the '' around auto. Consider doing this on the server side.

It looks like your using this to build an SQL query...

See here for the reason PHP deprecated it for that exact reason: http://en.wikipedia.org/wiki/Magic_quotes

Hope this helps,

Jeffrey Kevin Pry

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM