I needed to find a way to invoke the real escape / unescape javascript function over a string in C#.
It appeared to be easy to do so by using the Microsoft.JScript namespace classes.
Add a reference to it and then you can simply do something like this:
string escaped = Microsoft.JScript.GlobalObject.escape("This will be JS escaped for sure!");
"escaped" variable will then have the value of :
This%20will%20be%20JS%20escaped%20for%20sure%21
I am still very new to this namespace, there were a lot of things to find out there ...
Check it out. It may appear to be very useful for those of you who are processing JS on-the-fly...
No comments:
Post a Comment