문제

I have been trying to export a Word document into Response using ASP.Net. So I achieved this goal with this code.

Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentEncoding = Encoding.UTF8;
Response.Charset = "UTF-8";
Response.Buffer = true;

this.EnableViewState = false;
Response.ContentType = "application/msword";
Response.AddHeader("content-disposition", "attachment;filename=ExportedData" + Guid.NewGuid().ToString().Remove(5) + ".docx");

var wordData = this.RequestService.ExportToWord(this.RequestItem);

Response.BinaryWrite(wordData);
Response.Flush();

//Response.Clear();
//Response.End();
//Response.Close();
//RedirectToSamePage();
//Response.Flush();

But the problem is, when user export tha page as word document, the other functionality of the page disappears. Like, you can't click to another ASP control, because ending Response object, kills ASP controls connection with DLL. So, as you can see from the commented codes, I have been calling some Response object functions, but still I can't manage other ASP controls to work after Export operation. So, how can I manage that?

Thanks in advance.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top