我有一个测试页 Test.aspx,下面是我在 Page_Load 函数中的代码。
Response.Write("test");
当我执行这个页面时,我可以看到 html 输出“测试”以及 html, body 标签在里面。
我应该怎么做才能使输出只有文本“test”,而没有 body、html 标签?
请提出建议。
最佳答案
您可以尝试使用此代码 - 基于 ContentType = "text/plain";
Response.Clear();
Response.ContentType = "text/plain";
Response.Write("Only text is printed");
Response.End();
关于c# - 呈现没有 html、body 标签的 .aspx 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12477001/