asp.net - HTTP Response is corrupting the return string -
i have controller action in web api return string token below.howver, problem whenever there '/' appear in server side response string, @ client side '/' instead '\' addition original string. how can rid of it?
public string gettrackprofile() { string token="0q2l7m4daekjct/yixk0txzyzaxjzmyzq6+oaxhpnorrel7hez2vnkle61mf2zll"; return token; }
client side response
0q2l7m4daekjct/yixk0txzyzaxjzmyzq6+oaxhpnorrel7hez2vnkle61mf2zll
if string part of http header, should aware according rfc 2616 specification /
considered separator character , must escaped (which web api prepending \
):
many http/1.1 header field values consist of words separated lws or special characters. these special characters must in quoted string used within parameter value (as defined in section 3.6).
token = 1*<any char except ctls or separators> separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | sp | ht
update:
according comments, string part of json serialized response. encoded. let's take following example:
var json = {"d":"a\/b"}; alert(json.d);
when execute code correct string shown - a/b
. normal behavior.
Comments
Post a Comment