Response.Clear在ASP.NET 3.5 [英] Response.Clear in ASP.NET 3.5

查看:143
本文介绍了Response.Clear在ASP.NET 3.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近的服务器上安装的框架和acrodingly设置我的Web应用程序的升级,我的一些Web应用程序到ASP.NET 3.5,一切都很好,但是。

I have recently upgraded some of my web applications to ASP.NET 3.5 by installing the framework on the server and setting up my web applications acrodingly and all is well, however.

在一些网页,我想清楚了响应缓冲区与code这样的当前内容:

On some pages, I want to clear the current contents of the response buffer with code like this:

Response.Clear();
// Output some stuff
Response.End();

但是,这现在未在3.5工作时,它在2.0那样。我也曾尝试响应缓冲区设置为false,但是这也不能工作。

But this now isn't working in 3.5 when it did in 2.0. I have also tried setting the response buffer to false but this didn't work either.

任何人都可以让我知道为什么它不工作或者如果有一个变通?

Can anyone let me know why it isn't working or if there is a work around?

推荐答案

尝试在页面的Page指令,而不是在codebehind设置缓冲区=真。

Try setting Buffer="True" in the Page Directive of the page and not in codebehind.

我只是想这在VS2008的网站项目:

I just tried this in VS2008 on a Web Site project:


  1. 创建新项目

  2. 选择网页

  3. 将所有的HTML标记在那里,只是为了好玩

  4. 填写的Page_Load 像这样

protected void Page_Load(object sender, EventArgs e)  
{  
  Response.Write("test1");  
  Response.Clear();  
  Response.Write("test2");  
  Response.End();  
}


这将输出测试2没有任何HTML的标记。

It will then output "test2" without any html-tags.

这篇关于Response.Clear在ASP.NET 3.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆