Response.Write

linxy2002 2009-04-11 11:10:31
<!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>
...全文
76 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
supremeholy 2009-04-11
  • 打赏
  • 举报
回复
在前台页面中只保留 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication2.WebForm2" %>
其他的全部注释掉。
supremeholy 2009-04-11
  • 打赏
  • 举报
回复

<%@ 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!");
}
}
}

我姓区不姓区 2009-04-11
  • 打赏
  • 举报
回复
Response.Write("Name=Test ");
Response.End();
koukoujiayi 2009-04-11
  • 打赏
  • 举报
回复
Page.ClientScript.RegisterStartupScript(Page.GetType(), "err", "document.getElementById('form1').innerText='name=test'", true);
dengchenlu 2009-04-11
  • 打赏
  • 举报
回复
那直接JF了
wang355 2009-04-11
  • 打赏
  • 举报
回复
呵呵 那真替你遗憾,楼主辛苦了
supremeholy 2009-04-11
  • 打赏
  • 举报
回复
把前台页面中的html注释掉或删除。
CloudOfFly 2009-04-11
  • 打赏
  • 举报
回复
string s = string.Format("Name={0}",Test);
Response.Write(s);
linxy2002 2009-04-11
  • 打赏
  • 举报
回复
晕倒,自己知道解决方法了,

重载Render, 注释base.Render 就可以了


可惜我的100分啊,

成水贴了,回帖给分
linxy2002 2009-04-11
  • 打赏
  • 举报
回复
晕倒,自己知道解决方法了,

重载Render, 注释base.Render 就可以了


可惜我的100分啊,

成水贴了,回帖给分
linxy2002 2009-04-11
  • 打赏
  • 举报
回复
自己知道答案了,晕倒,
直接override Render, 注释base.Render()就可以了


大家回帖就给分,
真晕,我的100分啊。。。。

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧