2

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?

6
  • the .com is the issue. if you add a trailing slash / it should work. ie http://localhost:39897/api/users/verify/asldkfj/[email protected]/ Commented Aug 8, 2016 at 12:43
  • ? its part of a valid email address. How do I fix it? Commented Aug 8, 2016 at 12:44
  • sure its a valid email, but iis treats requests with file extensions as actual files and tries to find it on disk. when it can't find it then you get the 404 Commented Aug 8, 2016 at 12:45
  • Thanks... How do I fix it? Commented Aug 8, 2016 at 12:48
  • does it work when you add the extra slash? Commented Aug 8, 2016 at 12:48

1 Answer 1

1

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]/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.