Manas Sahu

Manas Sahu

  • 1.7k
  • 160
  • 6.2k

Index (zero based) must be greater than or equal to zero

Nov 6 2019 11:33 PM
try
{
MXResumeWordDoc resumeWordDoc = new MXResumeWordDoc();
var IsResumeLoaded = resumeWordDoc.LoadResumeWordDocByDID(neo as Neo, applicationID);
if (IsResumeLoaded)
{
string fileExtension = System.IO.Path.GetExtension(resumeWordDoc.Elements.FileName.Value).ToLower();
string fileName = System.IO.Path.GetFileName(resumeWordDoc.Elements.FileName.Value).ToLower();
MemoryStream stream= new MemoryStream();
HttpResponse response1 = HttpContext.Current.Response;
response1.AddHeader("Content-Disposition", string.Format("attachment; filename=\"{0}.doc\""));
using (FileStream fs = new FileStream(fileName, FileMode.Create, System.IO.FileAccess.Write))
{
stream.WriteTo(fs);
}
response1.Flush();
response1.End();
}
response.Results.Add("response1");
}
catch (Exception ex)
{
neo.SendInformationalMXM("ResumeService", ex.Message, ex, this, "ResumeService.GetResume");
throw ex;
}
return response;
This code throwing Index (zero based) must be greater than or equal to zero and less than the size of the argument list. exception from the below line
response1.AddHeader("Content-Disposition", string.Format("attachment; filename=\"{0}.doc\""));
How to fix it?

Answers (1)