[HttpPost]
Public ActionResult ImportData (HttpPostedFileBase ImportFile)
{
AjaxResult res=new AjaxResult ();
//TODO validation file type
Var filePath=Path. GetTempFileName ();
Try
{
ImportFile. SaveAs (filePath);
}
The catch (IOException ex)
{
Return the Error (" disk space is insufficient, please inform the technicians!" );
}
HttpContext CTX=System. Web. HttpContext. Current;
Task. Run (()=& gt;
{
System. Web. HttpContext. Current=CTX;
Try
{
_dev_DutyInfoBus. ImportBatch (filePath);
}
The catch (Exception ex)
{
SessionHelper. Session [" DutyInfoImportProgress "]=new AjaxResult ()
{
Success=false,
Msg=ex. Message,
Data=https://bbs.csdn.net/topics/-1
};
}
});
Return Success ();
}
Public void ImportBatch (string importFilePath)
{
//initialize the progress for 1
SessionHelper. Session [" DutyInfoImportProgress "]=new AjaxResult ()
{
Success=true,
Msg="operation is successful,"
Data=https://bbs.csdn.net/topics/1
};
.
}
I will pass the request before calling asynchronous task, after testing can actually get to the value, I would like to ask is, I do so? Will there be hidden? Whether there is any other way?