Home » c# » How to escape the forward slash in the string in javascript? C# web api not recognizing the forward slash

How to escape the forward slash in the string in javascript? C# web api not recognizing the forward slash

Posted by: admin February 21, 2020 Leave a comment

Questions:

How do i escape forward slash in javascript ?
string str= “[B]Hello How are you[/B]”.
This is the string i want to pass from client side to c# web api.
C# web api not recognizing forward slash in the string. – “[REM][TB]Hello How are you[%2FTB]”

How to&Answers:

You can try with below replace function to remove your escape sequences:

str.replace(/\//g, "");