Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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();
Posted
Updated 10-Feb-17 10:53am

1 solution

When you use the @ symbol, you don't need to double the slashes. Try this:
@"\\sapacpapp001v\sapmnt\transf\in\Currency\Rates_SAP_" + dt + "_Eur.txt"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900