title: Getting a 500 internet server error
body: <p>I've got 2 intranet sites:</p>
  
  <pre><code>http://intranetv1/
  http://intranetv2/
  </code></pre>
  
  <p>v1 is based on .NET 1.1, and v2 is based on .NET 3.5</p>
  
  <p>On v1, I've created a webpage and I am trying to use some jQuery to access a webservice I created on v2.  As the webservices is coded using .NET 3.5, I can't have that webservices on v1.</p>
  
  <p>Anyway, I assume I am supposed to make use of JSONP in this case, but each time I run the page, the ajax part does not work and in google chrome, I just get a 500 error message, as in cancelled.</p>
  
  <p>I can't figure out why this is happening.</p>
  
  <p>Here is the jQuery which is on the v1 .NET 1.1 server:</p>
  
  <pre><code>function selectedDateTime(strDate, strHours, strMinutes) {
  
      $.ajax({
          type: 'POST',
          url: 'http://intranetv2/webservices/meetingrooms.asmx/GetDayCount',
          data: '{ strMeetingDate:"' + strDate + " " + strHours + ":" + strMinutes + ":00" + '" }',
          contentType: 'application/json; charset=utf-8',
          dataType: 'jsonp',
          success: function(department) {
              alert("success");
          },
          error: function(xhr, status, error) {
              alert("error");
          }
      });
  
      return strDate + "---" + $("#txtDate").val();
  
  }
  </code></pre>
  
  <p>As you can see, I am trying to access an .asmx file on the v2 .NET 3.5 server.</p>
  
  <p>When I run this, google chrome gives me an 500 server error and says that the asmx file has been cancelled, and I then get an alert showing me the date alert at the end of the selectedDateTime function.  So the function is executing, but the success or error parts of the ajax script are not being executed at all.</p>
  
  <hr>
  
  <p>I am getting the following response:</p>
  
  <pre><code>Request URL:http://intranetv2/webservices/meetingrooms.asmx/GetDayCount?callback=jQuery110100248512071557343_1372419413424&amp;{%20strMeetingDate:%2228/06/2013%2006:00:00%22%20}&amp;_=1372419413425
  Request Method:GET
  Status Code:500 Internal Server Error
  
  Request Headers
  GET /webservices/meetingrooms.asmx/GetDayCount?callback=jQuery110100248512071557343_1372419413424&amp;{%20strMeetingDate:%2228/06/2013%2006:00:00%22%20}&amp;_=1372419413425 HTTP/1.1
  Host: intranetv3
  Connection: keep-alive
  Authorization: Negotiate TlRMTVNTUAADAAAAGAAYAHYAAAAYABgAjgAAABIAEgBIAAAABgAGAFoAAAAWABYAYAAAAAAAAACmAAAABYKIogUBKAoAAAAPQgBQAEMATwBMAEwASQBOAFMAaQB4AGYASQBYAEYALQBHAEIASgBUAEIAMgBKAJBkNIpqc7C+AAAAAAAAAAAAAAAAAAAAAIGOnhAoLt95s2HzXVTV7AvYOt1c9vbdJQ==
  Accept: */*
  User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36
  DNT: 1
  Referer: http://intranetv1/meeting/meeting_room_bookings_2_1.aspx
  Accept-Encoding: gzip,deflate,sdch
  Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
  Query String Parametersview sourceview URL encoded
  callback:jQuery110100248512071557343_1372419413424
  { strMeetingDate:"28/06/2013 06:00:00" }:
  _:1372419413425
  
  Response Headers
  HTTP/1.1 500 Internal Server Error
  Date: Fri, 28 Jun 2013 11:36:57 GMT
  Server: Microsoft-IIS/6.0
  X-Powered-By: ASP.NET
  X-AspNet-Version: 2.0.50727
  Cache-Control: private
  Content-Type: text/plain; charset=utf-8
  Content-Length: 406
  </code></pre>
  
  <hr>
  
  <p>Here is a screenshot of the error message I am getting in Google Chrome Developer Tools:
  <img src="https://i.stack.imgur.com/ehMfW.png" alt="enter image description here">
  <a href="https://i.stack.imgur.com/ehMfW.png" rel="nofollow noreferrer">Click here for full resolution</a>.</p>
  
  <hr>
  
  <p>Here is the .asmx code:</p>
  
  <pre><code>[WebMethod()]
  public double GetDayCount(string strMeetingDate)
  {
      string[] strDateAndTime = strMeetingDate.Split(' ');
  
      string[] strStartDateParts = strDateAndTime[0].Split('/');
      string[] srtStartTimeParts = strDateAndTime[1].Split(':');
  
      int year = Int32.Parse(strStartDateParts[2]);
      int month = Int32.Parse(strStartDateParts[1]);
      int day = Int32.Parse(strStartDateParts[0]);
      int hour = Int32.Parse(srtStartTimeParts[0]);
      int min = Int32.Parse(srtStartTimeParts[1]);
      int sec = Int32.Parse(srtStartTimeParts[2]);
  
      DateTime meetingDate = new DateTime(year, month, day, hour, min, sec);
  
      using (connection = new SqlConnection(ConfigurationManager.AppSettings["connString"]))
      {
  
          using (command = new SqlCommand("intranet.dbo.BusinessHours", connection))
          {
  
              command.CommandType = CommandType.StoredProcedure;
              command.Parameters.Add("@meeting_date", SqlDbType.DateTime).Value = meetingDate;
  
              connection.Open();
  
              using (reader = command.ExecuteReader())
              {
                  reader.Read();
                  return (double)reader["hours"];
              }
          }
      }
  </code></pre>