3

I have a similar requirement which is mentioned in the link Dots in URL causes 404 with ASP.NET mvc and IIS . Our requirement is, we also do have URLs with dots in the path. For example I may have a URL such as www.example.com/people/michael.phelps (This example is taken from above link) URLs with the dot generate a 404. If we pass without the dot, then everything works. If we add the dot I get a 404 error.

The above link provide solution for earlier versions of .net where we can have webconfig files. But we are using .net core to build web API application. Dotnet core does not support webconfig files. Can someone please suggest how can we arrive at the solution by using .net core.

7
  • share how your routing is configured. Simple routing like [HttpGet("/before.after")] works fine for me. Commented Sep 27, 2017 at 17:27
  • Do not forget to append trailing slash like www.example.com/people/michael.phelps/, it should work Commented Sep 29, 2017 at 14:25
  • We use attribute routing. before.after will not work for us as we do not have idea on how many dots are present in the path. For example, dit.web.config Commented Oct 5, 2017 at 7:55
  • Show an example of the attribute route that fails? Commented Oct 10, 2017 at 10:28
  • This is how we have defined our method in API controller [Route("~/api/HierarchyProperty/store/{store}/hierarchy/{*hierarchy}")] [HttpGet] public Dictionary<string, string> GetByName(string store, string hierarchy) { return this.hierRep.Get(store, hierarchy); } Commented Oct 12, 2017 at 3:19

1 Answer 1

1

Late answer but we had a similar case:

We had a url looking like https:/domain.com/somepath/smoething.cd

This returned a 404 from the IIS. Adding a / at the end of the url behind the .cd fixed the issue.

Strange but notable: not all.something return a 404, .com at the end of the path for example works

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

1 Comment

Yes, I've also noticed this kind of problem. Adding a / at the end is a workaround. Since I'm using Kestrel, it doesn't seem to be an IIS Issue, also I'd like to notice, that it just doesn't match the route, but middleware after routing will still be executed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.