my requirement is automatically save the file from data table using file stream when click the button from SharePoint site using C#. I tried to achieve this using below code. But it shows webpage declined to show this page error when click the button
What I have tried:
I tried to achieve this using below code. But it shows webpage declined to show this page error when click the button
byte[] txtFile = System.Text.Encoding.ASCII.GetBytes(sb.ToString());
mstxt.Write(txtFile, 0, txtFile.Length);
mstxt.Position = 0;
FileStream file = new FileStream(@"\\\\sapacpapp001v\\sapmnt\\transf\\in\\Currency\\Rates_SAP_" + dt + "_Eur.txt", FileMode.Create, FileAccess.Write);
mstxt.WriteTo(file);
file.Close();