2016-01-23 102 views
-1

我正面临一个问题。将json数据传递给带有特殊字符的WebApi

我有一个字符串值,我通过web api控制器。

如果我通过"myValue",它在控制器接收作为为"myValue"但如果我通过"&&myValue"比它被接收作为null

有什么想法吗?

代码:

Web客户端

factory.downloadStrudentReport = function(date, Name) { 
    $rootScope.$broadcast('dowload', _url + 'GetStudentPdfReport', { date: date, Nanme: Name}); 
}; 

服务器

[HttpGet] 
[Route("GetStudentPdfReport")] 
public HttpResponseMessage GetStudentPdfReport(DateTime date, string stuName) 
} 

////////////// 
{ 

另一篇文章, Passing json data to a WebApi with special characters results to null

说,client.Encoding = Encoding.UTF8;但不知道在哪里? 有什么想法?

+0

请向我们显示您的代码。 – ramiramilu

+0

我已添加代码。 – simbada

回答

相关问题