2012-05-09 4 views
0

클라이언트에서 다운로드해야하는 XDocument 개체가 있습니다. 이 xml은 page_load에서 생성 된 후 다운로드로 사용자에게 전송됩니다.클라이언트에 XML 파일 보내기

나는 중요한 파일없이 클라이언트에 개체를 보내는 방법을 알지 못합니다. 아이디어가 있으십니까?

+1

(http://stackoverflow.com/questions/5806675/how-to-dynamically-creating-the-xml-file-content-and-sending-as-a-text-file-in을하지 참조 꽤 복잡하지만 관련이 있습니다) –

+0

페이지에 표시 할 XML은 무엇입니까? –

+0

아니요 xml은 데이터 소스에서 생성 된 다음 다운로드 용 파일로 사용자에게 전송됩니다. xml은 페이지에 표시되지 않습니다. –

답변

0

내가 말한 바와 같이 this other post은 꽤 비슷하지만 충분히 가깝다.

Response.Clear(); 
Response.ContentType = "text/xml"; 
Response.AppendHeader("Content-Disposition","attachment;filename=" + DateTime.Now+".xml"); 
Response.Write(doc.ToString()); 
Response.End(); 
관련 문제