Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一些XElement element(我可以从数据库中加载它)。我需要在页面上放置一个链接,以便在单击它后用户可以下载从element.ToString(). 在用户单击此链接之前,我不想将此文档保存到文件中。
XElement element
element.ToString()
怎么做?
提前致谢
您可以在将 XML 返回给客户端之前将其保存在服务器上:
string file = Server.MapPath("~/somefolder/somefile.xml"); File.WriteAllText(file, element.ToString());