asp.net(c#)中,Response.End()有无存在必要? 以前学C#的时候,都是用"return"现在弄Web,觉得没必要用Response.End()它们有什么区别?请指教。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Response.End()是停止页面html代码的书写return是返回停止该函数操作 Response.End() 是停止服务器端页面代码输出 这两个好像没有什么关系的吧。response.end应该表示应答结束的吧。 例如:protected void Page_Load(object sender, EventArgs e) { Response.End(); }输出:<!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><title> 无标题页</title></head><body> <form name="form1" method="post" action="Default.aspx" id="form1"><div><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGSr3Z4GoFkkYIkS3gjEDZgu5z75Fg==" /></div> <div> </div> </form></body></html>protected void Page_Load(object sender, EventArgs e) { return; }输出:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=gb2312"></HEAD><BODY></BODY></HTML> 你的意思是:就算用了Response.End(),下面的代码继续执行(除了页面html代码的书写)? return是用在方法中的 表示跳出方法 response.end则是停止运行代码,直接输出 Response.End()是停止对Html中<body>内容的输出Return是建立好了各个组件,停止数据处理 return是用在方法中的 表示跳出方法 response.end则是停止运行代码,直接输出停止的应该是js代码吧 获取ListView控件中被选中项 SocketAsyncEventArgs使用问题 小弟刚学编程,求3个数比较大小的代码,要经过测试的 问题又来了~高手帮帮! 谁能帮忙用c#写个文件下载和上传的webservice?谢谢~ 基于windows的程序启动IE后,和IE交互的问题(谢绝灌水!)。 请问一个问题......变量定义 生僻字问题 c#如何实现禁用软件,仅允许列表内软件可以运行。 一些关于类相关的问题? loadxml()方法使用问题 程序的问题,
是停止页面html代码的书写
return
是返回停止该函数操作
是停止服务器端页面代码输出
protected void Page_Load(object sender, EventArgs e)
{
Response.End();
}
输出:
<!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><title>
无标题页
</title></head>
<body>
<form name="form1" method="post" action="Default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGSr3Z4GoFkkYIkS3gjEDZgu5z75Fg==" />
</div> <div>
</div>
</form>
</body>
</html>
protected void Page_Load(object sender, EventArgs e)
{
return;
}
输出:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312"></HEAD>
<BODY></BODY></HTML>
表示跳出方法
response.end则是停止运行代码,直接输出
Response.End()
是停止对Html中
<body>内容的输出
Return是建立好了各个组件,停止数据处理
表示跳出方法
response.end则是停止运行代码,直接输出
停止的应该是js代码吧