I am passing string having special characters in to contollers action in asp.net mvc3. In action its taking string data as null.
var url = '@Url.Action("SetData", "Home")';
var data = { Text: a, Data: urlData };
$.post(url, data, function (result) {
});
Controllers Action:
public ActionResult SetData(string Text, string Data)
{
}
My String data is :
Content Belongs To Tseries and Eros Entertainment Song : Tum Ho Movie : Rockstar Singer : Mohit Chauhan & Suzzane D' Mello Music By : AR Rahman Rockstar is a
How can i pass string having special characters?
The
urlDatavariable contains HTML encoded entities. You need to HTML decode it first, like this:Or maybe change the way you are retrieving the contents of this variable. I think this is where your problem lies essentially.
or on the server side if you prefer (the first solution is recommended):