Reputation: 2676
I have the following routes set up in a user controller:
[EnableCors("*", "*", "*")]
[RoutePrefix("api/users")]
[Authorize]
public class UserController : ApiController
{
[Route("")]
public IHttpActionResult Get()
{
}
[HttpGet]
[Route("{id:int}")]
public IHttpActionResult Get(int id)
}
[HttpPost]
[Route("validateUser")]
public IHttpActionResult ValidateUser()
{
}
[HttpPost]
[Route("verify/{identityId}/{emailAddress}")]
public void VerifyUserEmailAddress(string identityId, string emailAddress)
{
}
}
The first three routes work just fine. But the fourth fails with a 404. I'm using fiddler to make the call:
http://localhost:39897/api/users/verify/asldkfj/[email protected] (post is selected)
Does post require data sent in the body? Can anyone see what I'm doing wrong and why the verify route is not being found?
Upvotes: 2
Views: 98
Reputation: 247551
The .com
in the email is the issue.
Sure its a valid email, but IIS treats requests with file extensions as actual file requests and tries to find it on disk. When it can't find it then you get the 404 Not Found
If you add a trailing slash /
to the request it should work.
ie http://localhost:39897/api/users/verify/asldkfj/[email protected]/
Upvotes: 1