Hi Guys,
I was just wondering, how can i achieve this..
I want to create a csv file on server side and prompt user to download it using c# with asp.net
I have written some codes which create a dummy text file..and some download code..but the download code does not fetch the actual test.csv file which i created, instead it gives me the html code where the download dialogue box was prompted
StreamWriter streamWriter = new StreamWriter("C:\\Mail\\test.txt");
streamWriter.WriteLine("Date : ");
streamWriter.WriteLine("From : " );
streamWriter.WriteLine("To : ");
streamWriter.WriteLine("Subject : ");
streamWriter.Close( );
Response.ContentType = "text/plain";
Response.AddHeader( "Content-Disposition", "attachment; Filename = C:\\Mail\\test.txt");
How can i solve this?
I was just wondering, how can i achieve this..
I want to create a csv file on server side and prompt user to download it using c# with asp.net
I have written some codes which create a dummy text file..and some download code..but the download code does not fetch the actual test.csv file which i created, instead it gives me the html code where the download dialogue box was prompted
StreamWriter streamWriter = new StreamWriter("C:\\Mail\\test.txt");
streamWriter.WriteLine("Date : ");
streamWriter.WriteLine("From : " );
streamWriter.WriteLine("To : ");
streamWriter.WriteLine("Subject : ");
streamWriter.Close( );
Response.ContentType = "text/plain";
Response.AddHeader( "Content-Disposition", "attachment; Filename = C:\\Mail\\test.txt");
How can i solve this?