ApiController returns 404 when ID contains period

前端 未结 3 1366
别跟我提以往
别跟我提以往 2020-11-27 19:35

I have an ApiController and I want to use email addresses as the ID parameter for requests:

// GET api/employees/email@address.com
public CompactEmployee Get         


        
3条回答
  •  长情又很酷
    2020-11-27 19:48

    This is what worked for me:

    I was running on targetFramework = 4.6.1. I have upgraded to 4.6.2 and added this in web.config:

    
            
            
            
            
      
    

    The requestPathInvalidCharacters="" is to be able to have stuff like & etc in URI, in encoded form, of course.

提交回复
热议问题