How to pass special character from C# to JavaScript via ScriptManager.RegisterStartupScript

120 Views Asked by At

I want to pass a string that contain a special character as a paramaert of JS function from C# like the following:

string param = "sm~aEkv{yEb@~IX`GVhG@\\BZ@bA?L";
string jsFunction = "viewPathOnMap(\"" + param+ "\");";
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", jsFunction, true);

When I am debugging in the JavaScript side, I find the value is received as:

sm~aEkv{yEb@~IX`GVhG@BZ@bA?L

not like:

sm~aEkv{yEb@~IX`GVhG@\BZ@bA?L

What I can do in this case?

0

There are 0 best solutions below