2

My WebAPI method looks like this:

[Route("api/v1.0/Profile/Test/{offset}")]
public async Task<ServiceResult> GetTest(DateTimeOffset offset)
{
...
}

Calling it like this works: http://localhost:54295/api/v1.0/Profile/Test/2016-04-05T13:30:44-11:00

However, this call won't work: http://localhost:54295/api/v1.0/Profile/Test/2016-04-05T13:30:44+11:00

What's the trick here?

In my Web.config in the system.web section I have this entry:

<httpRuntime targetFramework="4.5" requestPathInvalidCharacters="&lt;,&gt;,%,&amp;,*,\,?" />
hholtij
  • 2,906
  • 6
  • 27
  • 42
  • 1
    Possible duplicate of [Passing DateTimeOffset as WebAPI query string](http://stackoverflow.com/questions/28549737/passing-datetimeoffset-as-webapi-query-string) – Brandon Minnick Apr 19 '17 at 00:28

1 Answers1

1

I found a solution:

In my web.config in the system.webServer section I added this block:

<security>
  <requestFiltering allowDoubleEscaping="true" />
</security>   

Now the plus sign works as desired.

hholtij
  • 2,906
  • 6
  • 27
  • 42