title: Validate GUID as parameter
body: <p>My routing is:</p>
  
  <pre><code>public void RegisterRoute(HttpRouteCollection routes) {
      routes.MapHttpRoute(
          name: "DefaultApi",
          routeTemplate: "api/{controller}/{guid}",
          defaults: new { guid = RouteParameter.Optional }
      );
  }
  </code></pre>
  
  <p>controller action is like</p>
  
  <pre><code>public IHttpActionResult Get(Guid guid) {
  </code></pre>
  
  <p>When I pass <code>api/{controller}/2ADEA345-7F7A-4313-87AE-F05E8B2DE678</code> everything works fine but when I pass invalid value for guid like</p>
  
  <p><code>api/{controller}/xxxxxx</code> then I get error :</p>
  
  <pre><code>{
    "message": "The request is invalid.",
    "messageDetail": "The parameters dictionary contains a null entry for parameter 'guid' of non-nullable type 'System.Guid' for method 'System.Web.Http.IHttpActionResult Get(System.Guid)' in 'Web.API.Controller.UserController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter."
  }
  </code></pre>
  
  <p>How can I display my own message like: </p>
  
  <pre><code>{
    "guid": "The value is invalid.",
  }
  </code></pre>
  
  <p>I'm trying to create custom model binder but it is not working</p>
  
  <pre><code>public class GuidModelBinder : IModelBinder {
  
          public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) {
              var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
              if (value == null) {
                  bindingContext.ModelState.AddModelError("guid", "The value is invalid");
                  return false;
              }
  
  
              var result = Guid.TryParse(value.ToString(), out _);
              if (!result) {
                  bindingContext.ModelState.AddModelError("guid", "The value is invalid");
              }
              return result;
          }
      }
  </code></pre>
  
  <p>Please help. How can I show only my message</p>