There is a javascript code, a fragment of the class method:
var formData = new FormData(); formData.append("lat", this.LatLng.lat); var xhr = new XMLHttpRequest(); xhr.open("POST", "/MyDbService.asmx/MyDbMethod", true); xhr.send(formData); Fragment of the web service MyDbMethod method:
string request_lat = Context.Request.Params["lat"]; bd.WriteToLog("request_lat = " + request_lat); double lat = double.Parse(request_lat, CultureInfo.InvariantCulture); bd.WriteToLog("lat = " + lat); I check the received data on the web service side, writing a log to a text file, in a javascript I output to the console.
The lat parameter is successfully transmitted to the server, first read into the request_lat variable, and then already in the lat status it is also successfully written to the log. However, the response from the server comes as follows:
`System.ArgumentNullException:` Значение не может быть неопределенным. Имя параметра: `value` в `System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)` в `System.Double.Parse(String s, IFormatProvider provider)` в `MyDbService.MyDbMethod() в <...>MyDbService.asmx.cs:`строка 107Line 107 contains the
double.Parsemethoddouble.Parse.
What could be the problem?
Update
I know about the presence of an exception in the browser console. The web service method continues to work after line 107, writing to the database is successful (I Context.Response.Write testing now without writing), the data recorded via Context.Response.Write are successfully transferred to the browser. The browser writes to the console "incorrectly" and when you click on the link in the new window opens a message about the exception.
Context.Request.Params["lat"]- why not declare it as a parameter of the method explicitly? - nzeemin