Actually request.
var xml = "example"; function send(xml) { //отправка данных на сервер $.ajax({ type: 'POST', url: '/Home/Form', data: xml, success: function (responce) { SaveToLocal("s",xml);// префикс s - sended notification("Данные успешно отправлены", "success"); }, error: function (xhr, str) { SaveToLocal("u",xml);// префикс u - unsended notification("Подключение недоступно, данные сохранены в локальном хранилище","warning"); setTimeout(DelayResend, 30 * 1000);// функция отложенной отпраки с тайм аутом 30 сек. } }) }; Controller:
[HttpPost] public void Form(string xml) { string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); using (StreamWriter outputFile = new StreamWriter(mydocpath + @"\WriteLines.txt")) outputFile.WriteLine(xml); // return View(); } Form must write a string to a file. The file is being created, but it is empty. During the transfer, the "success" block is executed - it means there are no transmission errors. But where is the string lost?