作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我收到以下消息:
[Route("/devices/{DeviceId}/punches/{EmployeeId}/{DateTime}", "GET,POST")]
public class Punch
{
public string DeviceId { get; set; }
public string EmployeeId { get; set; }
public DateTimeOffset DateTime { get; set; }
public string TimeZoneId { get; set; }
public PunchKind Kind { get; set; }
}
DateTimeOffset
在日期时间部分...
http://localhost:54146/devices/1001/punches/666/2012-04-01
http://localhost:54146/devices/1001/punches/666/2012-04-01T20:59:00.0000000-03:00
http://localhost:54146/devices/1001/punches/666/2012-04-01 20:59:00.0000000-03:00
http://localhost:54146/devices/1001/punches/666/2012-04-0120:59:00.0000000-03:00
http://localhost:54146/devices/1001/punches/666/2012-04-01T20%3A59%3A00.0000000-03%3A00
最佳答案
<,>,*,%,&,:
和 \
默认情况下,ASP.NET 不允许在 URL 中使用。在您的情况下,冒号是罪魁祸首(是否已编码并不重要)。您可以通过将以下内容添加到您的 Web.config 文件来修复它:
<system.web>
...
<httpRuntime requestPathInvalidCharacters="<,>,*,%,&,\" />
...
</system.web>
关于asp.net - 如何在 ServiceStack 中传递 DateTimeOffset 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17243687/
我是一名优秀的程序员,十分优秀!