Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 01, 2013 11:16 AM by jaydeep.choudhari
Member
13 Points
41 Posts
Feb 27, 2013 01:04 PM|LINK
Hi,
I am writing ajax post function to call a MVC method from controller where I am passing HTML data as a parameter.
I can not send plain HTML as it gives Potentially Dangerous Request error.
I am sending it as escape( htmldata ) but at server side I am not able to get plain html using HttpUtility.HtmlDecode method.
So, How to encode html data from jQuery and decode it in c# code behind
Regards, Jay
Feb 27, 2013 01:09 PM|LINK
Solved -- encoding data using encodeURI from jQuery post and HttpUtility.UrlDecode in codebehind
All-Star
43715 Points
4304 Posts
Microsoft
Feb 28, 2013 02:32 AM|LINK
You can also use escape() and unescape(). More details, please refer to: http://www.w3schools.com/jsref/jsref_escape.asp.
Mar 01, 2013 11:16 AM|LINK
thanks for the answer. Here I wanted to decode the string in code behind file which was encoded in javascript
jaydeep.chou...
Member
13 Points
41 Posts
Encode decode html data
Feb 27, 2013 01:04 PM|LINK
Hi,
I am writing ajax post function to call a MVC method from controller where I am passing HTML data as a parameter.
I can not send plain HTML as it gives Potentially Dangerous Request error.
I am sending it as escape( htmldata ) but at server side I am not able to get plain html using HttpUtility.HtmlDecode method.
So, How to encode html data from jQuery and decode it in c# code behind
Regards,
Jay
jaydeep.chou...
Member
13 Points
41 Posts
Re: Encode decode html data
Feb 27, 2013 01:09 PM|LINK
Solved -- encoding data using encodeURI from jQuery post and HttpUtility.UrlDecode in codebehind
Song-Tian - ...
All-Star
43715 Points
4304 Posts
Microsoft
Re: Encode decode html data
Feb 28, 2013 02:32 AM|LINK
Hi,
You can also use escape() and unescape(). More details, please refer to: http://www.w3schools.com/jsref/jsref_escape.asp.
Feedback to us
Develop and promote your apps in Windows Store
jaydeep.chou...
Member
13 Points
41 Posts
Re: Encode decode html data
Mar 01, 2013 11:16 AM|LINK
thanks for the answer. Here I wanted to decode the string in code behind file which was encoded in javascript