编码问题服务堆栈,引号和尖括号被剥离 [英] Encoding issue service stack, quotes and angle bracket being stripped
问题描述
我有一个服务栈应用程序,一个测试服务接收到一个简单的请求,但是一旦收到请求,我就发现请求的值与原始请求不匹配.
I have a service stack application, A test service receives a simple request, but I'm finding the value of the request once received isn't matching the original request.
我发送:http://localhost/testapp/test?value=%22test%20data%22%20%3C12345%3E
但是代码输出:测试数据" 12345>
but the code outputs: test data" 12345>
请注意缺少的第一双引号和缺少的左尖括号.
Note the missing first double quote and the missing left hand angle bracket.
有什么想法为什么应用程序会删除第一个"和<"?它是某种XSS保护的一部分吗?
Any ideas why the application would be dropping the first " and the "<"? Is it part of some sort XSS protection?
我的代码:
public class TestService : RestServiceBase<RequestDto>, IRestService<RequestDto>
{
public override object OnGet(RequestDto request)
{
return request.Value;
}
}
public class RequestDto
{
public string Value { get; set; }
}
首先允许服务堆栈接收带有<"的请求.我不得不将应用程序web.config切换为使用:requestValidationMode ="2.0"
To allow service stack in the first place to receive requests with "<". I had to switch the applications web.config to use: requestValidationMode="2.0"
推荐答案
在即将发布的servicestack版本中,此问题也已得到解决.
This has also been fixed in an upcoming release of servicestack.
有关更多信息,请参见 github问题.
See this github issue for further information.
这篇关于编码问题服务堆栈,引号和尖括号被剥离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!