title: Working with date time in web api
body: <p>I have created a <code>WEB API</code>using <code>MySQL</code> database. The table includes the data about the meter's serial numbers it's signal strength values and the date time on which the signal strength has comes. For now i am successful in getting data by sending the meter's serial number. </p>
  
  <p>Now I am also sending the date time parameter to it also. But it's not working for me. Below is what i have done. </p>
  
  <pre><code>public HttpResponseMessage GetByMsn(string msn, DateTime dt)
          {
              try
              {
                  return Request.CreateResponse(HttpStatusCode.Found, medEntitites.tj_xhqd.Where(m=&gt; m.msn == msn).Where(a=&gt; a.date_time &lt; dt ));
              }
              catch (Exception ex)
              {
                  return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
              }
          }
  </code></pre>
  
  <p>The <code>WebApiConfig</code> file includes</p>
  
  <pre><code>config.Routes.MapHttpRoute(
         name: "GetByMsn",
         routeTemplate: "api/{controller}/{action}/{msn}/{dt}",
         defaults: null,
         constraints: new { msn = @"^[0-9]+$" , dt = @"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$" }
         );
  </code></pre>
  
  <p>After that I am passing the URL like <code>http://localhost:14909/api/meters/GetByMsn/000029000033/2017-10-06T07:52:27</code></p>
  
  <p>The error I am getting is <code>A potentially dangerous Request.Path value was detected from the client (:).</code></p>
  
  <p>For this I have also searched for the solutions but couldn't find out the correct one. Also I have replaced <code>:</code> in date time but still it's not working for me</p>
  
  <p><strong>Update 1</strong> </p>
  
  <p>While passing only date<code>2017-10-06</code> it works for me but when I append it with time it doesn't works </p>
  
  <p>For a quick check I checked this <a href="https://stackoverflow.com/questions/19692501/creating-a-route-that-can-accept-a-datetime-in-the-uri-with-asp-net-web-api-2-at">question</a> but still i am unable to solve the solution. </p>
  
  <p>I must be missing something that I don't know</p>
  
  <p>Any help would be highly appreciated.</p>