hi good morning
i have a problem with webservices on my web forms i am loading the latitude and longitude of a certain location from my database here is the code
<WebMethod()> _
Public Function setmylocation(proid As String) As List(Of locsetter)
Dim constring As String = ConfigurationManager.ConnectionStrings("blottedConnectionString2").ConnectionString
Dim con As New SqlConnection(constring)
Using cmd As SqlCommand = New SqlCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "proloc"
cmd.Parameters.AddWithValue("@id", proid)
cmd.Connection = con
con.Open()
Dim sdr As SqlDataReader
sdr = cmd.ExecuteReader()
Dim locations As New List(Of locsetter)
While sdr.Read
locations.Add(New locsetter)
locations((locations.Count - 1)).LATITUDE = sdr("lat").ToString
locations((locations.Count - 1)).LONGITUDE = sdr("long").ToString
End While
con.Close()
Return locations
End Using
End Function
and on my client side code
function set() {
$.ajax({
type: "POST",
url: "locations.asmx/setmylocation",
data: "{proid: '" + proid + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var urloc = response.d;
if (urloc[0].LATITUDE == '') {
initializemap(14.001424154457723, 121.1032415625, 7);
} else {
initializemap(urloc[0].LATITUDE, urloc[0].LONGITUDE, 10);
//alert('elo');
}
},
failure: function (response) {
alert(response.d);
}
});
}
the developer tools shows a 500 internal server error but ironically my 2 other jscript functions which calls 2 separate function from the same web service is just fine 200 ok on the developer tool
and i made sure to try these solutions
<system.webServer>
<handlers>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<configuration>
<system.web>
<webservices>
<protocols>
<add name="HttpGet"></add>
<add name="HttpPost"></add>
</protocols>
</webservices>
</system.web>
</configuration>
but to no avail
please help
thank you