<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
我在asp.net 代码里写 Response.Write("Name=Test");
我希望只得到Name=Test, 不要后面的一堆东西。高手帮忙啊得到的结果是:
Name=Test<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
Untitled Page
</title></head>
<body>
    <form name="form1" method="post" action="GetData.aspx?method=getallcoach" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGRVRZPshxvu60ze3GnCDC1uxVrMdA==" />
</div>    <div>
    
    </div>
    </form>
</body>
</html>

解决方案 »

  1.   

    自己知道答案了,晕倒,
    直接override Render, 注释base.Render()就可以了
    大家回帖就给分,
    真晕,我的100分啊。
      

  2.   

    晕倒,自己知道解决方法了,重载Render, 注释base.Render 就可以了
    可惜我的100分啊,成水贴了,回帖给分
      

  3.   

    晕倒,自己知道解决方法了,重载Render, 注释base.Render 就可以了
    可惜我的100分啊,成水贴了,回帖给分
      

  4.   

    string s = string.Format("Name={0}",Test);
            Response.Write(s);
      

  5.   

    把前台页面中的html注释掉或删除。
      

  6.   

    Page.ClientScript.RegisterStartupScript(Page.GetType(), "err", "document.getElementById('form1').innerText='name=test'", true);
      

  7.   

    Response.Write("Name=Test "); 
    Response.End();
      

  8.   


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication2.WebForm2" %><%--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        </div>
        </form>
    </body>
    </html>--%>using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;namespace WebApplication2
    {
        public partial class WebForm2 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                Response.Write("This is The Text!");
            }
        }
    }
      

  9.   

    在前台页面中只保留 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication2.WebForm2" %>
    其他的全部注释掉。