Solution :
I had also faced the similar issue in the recent past. I did lot of research on it and found the solution on it. This is the very common problem with the people getting started. You need to do a replace on the commas to just remove them and you should be all right. The function to make the valid filename is as below.
public static string MakeTheValidFileName(string myname)
{
string myinvalidChars = Regex.Escape(new string(System.IO.Path.GetInvalidFileNameChars()));
string myinvalidReStr = string.Format(@"[{0}]+", myinvalidChars);
string myreplace = Regex.Replace(myname, myinvalidReStr, "_").Replace(";", "").Replace(",", "");
return myreplace;
}
OR
You need to just put the pair of double quotes around the file name as shown below:
this.Response.AddHeader("Content-disposition", $"attachment; filename=\"{outputFileName}\"");
Hope the above solutions provided resolve the issue you are currently facing.