aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Multiple attributes in WebApi

Open TomGroeneboer opened this issue 11 years ago • 1 comments

Hi guys,

I'm working on a WebAPI project right now, but I can't get multiple variable routing to work. What am I doing wrong?

My controller has this route: [Route( "api/[controller]" )]

My action has this one:

[HttpGet]
[EnableCors( "mypolicy" )]
[Route( "GetTimeFrameMessages/{ timeRangeMin }/{ timeRangeMax }" )]
public IList GetTimeFrameMessages( string timeRangeMin, string timeRangeMax )

When I try to run this, with http://localhost:58496/api/search/GetTimeFrameMessages/1439423756203/1439452556203 as url, both timeRangeMin and timeRangeMax are null...

Does someone know what I'm missing?

Thanks!

TomGroeneboer avatar Aug 13 '15 08:08 TomGroeneboer

I figured out what was wrong. Apparently Routing cannot have spaces...

TomGroeneboer avatar Aug 13 '15 09:08 TomGroeneboer