Dot character '.' in MVC Web API 2 for request such as api/people/STAFF.45287
Following setting in your web.config
file should fix your issue:
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
How to support dots in WebApi2 urls for a pool running in Classic mode
Try this to set the correct handler for classicMode
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"
path="*"
verb="GET,HEAD,POST,DEBUG,DELETE,OPTIONS"
modules="IsapiModule"
scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll"
preCondition="classicMode,runtimeVersionv4.0,bitness32"
responseBufferLimit="0" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"
path="*"
verb="GET,HEAD,POST,DEBUG,DELETE,OPTIONS"
modules="IsapiModule"
scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll"
preCondition="classicMode,runtimeVersionv4.0,bitness64"
responseBufferLimit="0" />
</handlers>
MVC Web API: dot in URL parameter value
If the value being passed into the URL is a search term that can be entered by the user, I wouldn't configure my routing system to handle these values because they are unpredictable.
You should encode the string and pass it through the query string or post it and bind it to an object in WebAPI.
In terms opening the door to hell I think that you should consider the points raised in this question. If you have to set something like relaxedUrlToFileSystemMapping
which is something that appears to relax some of the default security systems of ASP.NET MVC I'd tend to lean towards a solution that doesn't rely on a change like this.
Web Api with & causing an error
The WebAPIConfig had constraints that was not including &. Included modified my regex expression to accept the character.
Related Topics
How to Rotate a Picture in Winforms
Difference Between Events and Delegates and Its Respective Applications
New Keyword in Method Signature
C# Is Rounding Down Divisions by Itself
Why Should I Prefer Single 'Await Task.Whenall' Over Multiple Awaits
Dynamically Generate Linq Queries
Equivalent to 'App.Config' for a Library (Dll)
Is a Double Really Unsuitable for Money
How to Call Functions in a Main View Model from Other View Models
Way to Have String.Replace Only Hit "Whole Words"
Type or Namespace Name Does Not Exist
Prevent .Net Garbage Collection for Short Period of Time
How to Calculate Float Type Precision and Does It Make Sense
Generating Permutations of a Set (Most Efficiently)
How to Get a Property Value Based on the Name
Impossible to Use Ref and Out for First ("This") Parameter in Extension Methods