当response.buffer = True时,ASP VBScript失败 [英] ASP VBScript fails when response.buffer = True

查看:65
本文介绍了当response.buffer = True时,ASP VBScript失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的asp文件在某些​​条件下有错误 - 完全

可重复。但是,当我在

顶部设置response.buffer = True时,它才会失败。当我将其设置为False以便进行调试时,它每次都有效!我甚至将
设置为True,但在错误发生之前做了一次.Flush,并且错误不会发生在b $ b上。


仅当response.buffer为True且没有.response.flush发出时才会发生。


错误是一个字符串变量空转并崩溃一个函数

需要约会。我可以在它崩溃的那一行之前对它进行测试,

但是我的数据去了哪里?为什么缓冲区会影响它?


尴尬!


-

James W.(Jim)Rodgers ,PE,是General Consulting的高级合伙人

Engineers,LLC,位于佐治亚州亚特兰大。

I have a big asp file that has an error under certain conditions -- totally
repeatable. However, it only fails when I set response.buffer = True at the
top. WHen I set it False in order to debug it, it works every time! I even
set it to True, but did a .Flush just before the error, and the error won''t
happen.

It only happens when response.buffer is True and no .response.flush is issued.

The error is a string variable turns-up empty and crashes a function
requiring a date. I could test for this before the line where it crashes,
but where did my data go? Why is the buffer affecting it?

Bewilderedness!

--
James W. (Jim) Rodgers, P.E., is a Senior Partner with General Consulting
Engineers, LLC, in Atlanta, Georgia.

推荐答案



" Jim Rodgers" < Ji ******** @ discussion.microsoft.com写信息

新闻:06 ******************** ************** @ microsof t.com ...

"Jim Rodgers" <Ji********@discussions.microsoft.comwrote in message
news:06**********************************@microsof t.com...

我有一个大的asp文件在某些​​情况下有错误条件 -
I have a big asp file that has an error under certain conditions --



总计

totally


可重复。但是,只有当我在
设置response.buffer = True时才会失败
repeatable. However, it only fails when I set response.buffer = True at




the


top。当我将其设置为False以便进行调试时,它每次都有效!我
top. WHen I set it False in order to debug it, it works every time! I



甚至

even


将其设置为True,但在错误发生之前做了.Flush,并且错误
set it to True, but did a .Flush just before the error, and the error



won''t

won''t


发生。


仅当response.buffer为True且没有.response.flush为
happen.

It only happens when response.buffer is True and no .response.flush is



时才会发生。

issued.


>

错误是一个字符串变量空转并崩溃一个函数

需要一个日期。我可以在它崩溃的那一行之前对它进行测试,

但是我的数据去了哪里?为什么缓冲区会影响它?


黯淡!
>
The error is a string variable turns-up empty and crashes a function
requiring a date. I could test for this before the line where it crashes,
but where did my data go? Why is the buffer affecting it?

Bewilderedness!



当然是。特别是因为你还没有确切地说明错误是什么?
并且发布了它失败的代码片段。


你使用的是IIS6还是5 ?

Certainly is. Especially since you haven''t stated exactly what the error is
and posted a code snippet of where it is failing.

Are you using IIS6 or 5?


>

-

James W.(Jim)Rodgers,PE ,是General Consulting的高级合伙人

Engineers,LLC,位于佐治亚州亚特兰大市。
>
--
James W. (Jim) Rodgers, P.E., is a Senior Partner with General Consulting
Engineers, LLC, in Atlanta, Georgia.





"错误是一个字符串变量空转并崩溃一个函数

需要一个日期。


只有当response.buffer为True并且没有.response.flush是

时才会发生。"


a ??


这里是代码失败的代码:


< div<%= FormatDateTime(strManifestDate,2)%< / div>


由于strManifestDate为空,它失败了。就好像buffer = true

设置改变了VBScript代码的执行顺序。完全相同的

测试用例,当缓冲区= false时,这种情况永远不会失败。


唯一的脚本函数是由DHTML触发的javascript单行
活动。没有任何脚本处理strManifestDate,并且所有这些脚本都会导致当前页面退出

。这似乎不是空的

变量的根本原因。

我的下一次调试尝试是将调试语句写入IIS日志
而不是HTML输出流。也许这将揭示当缓冲区=真时,这个

变量如何变空。


(注意:当buffer = true时,使用response.write进行调试不会工作,

当然:服务器脚本在输出任何东西之前就失败了。这是海森堡不确定性原理的一个很好的例子!)


这有助于任何人理解这个谜团吗?我真的需要从buffer = true获得额外的

性能,所以我不能简单地将其关闭并继续前进。


a ?? Jim


-

James W.(Jim)Rodgers,PE,是General Consulting的高级合伙人

工程师, LLC,位于佐治亚州亚特兰大。


"The error is a string variable turns-up empty and crashes a function
requiring a date."

"It only happens when response.buffer is True and no .response.flush is
issued."

a??

And here''s the code where it fails:

<div<%=FormatDateTime(strManifestDate,2)%</div>

It fails because strManifestDate is empty. It is as if the buffer=true
setting changes the execution order of the VBScript code. The exact same
test case where this happens NEVER fails when buffer=false.

The only script functions are javascript one-liners triggered by DHTML
events. None of the scripts processes strManifestDate, and all of them cause
the current page to exit. It seems these are not the root cause of the empty
variable.

My next debug attempt will be to write debug statements to the IIS Log
instead of the HTML output stream. Perhaps this will reveal how this
variable winds up empty when buffer=true.

(NOTE: When buffer=true, debugging with response.write does not work, of
course: the server script fails before outputting anything. This is an
excellent example of the Heisenberg Uncertainty Principle!)

Does this help anyone understand the mystery? I really need the extra
performance from buffer=true, so I can''t simply turn it off and move on.

a?? Jim

--
James W. (Jim) Rodgers, P.E., is a Senior Partner with General Consulting
Engineers, LLC, in Atlanta, Georgia.


Jim Rodgers写道:
Jim Rodgers wrote:

"错误是一个字符串变量空转并崩溃一个函数

需要一个日期。


只有当response.buffer为True时才会发生没有.response.flush

已经发出。


-


这里是代码它失败的地方:


< div<%= FormatDateTime(strManifestDate,2)%< / div>
"The error is a string variable turns-up empty and crashes a function
requiring a date."

"It only happens when response.buffer is True and no .response.flush
is issued."

-

And here''s the code where it fails:

<div<%=FormatDateTime(strManifestDate,2)%</div>



LOL

您真的希望我们能够基于此重现或诊断您的

症状???

至少告诉我们strManifestDate是如何定义的。

LOL
Do you really expect us to be able to reproduce or diagnose your
symptoms based on this???
At least tell us how strManifestDate is defined.


>

由于strManifestDate失败是空的。好像

buffer = true设置改变了VBScript代码的执行顺序。

完全相同的测试用例,当这种情况发生时不会失败

buffer = false。
>
It fails because strManifestDate is empty. It is as if the
buffer=true setting changes the execution order of the VBScript code.
The exact same test case where this happens NEVER fails when
buffer=false.



除了必须用strManifestDate做的事情之外,还要从页面中取出所有其他内容。使用两种缓冲设置进行测试,并确保它可以使用
。然后逐步添加内容直到将缓冲区设置为true

导致它失败。告诉我们你添加了什么让它失败。


鲍勃巴罗斯


-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。

Take everything else out of the page except the stuff that has to do
with strManifestDate. Test it with both buffer settings and make sure it
works. Then incrementally add stuff back in until setting buffer to true
causes it to fail. Tell us what you added that makes it fail.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


这篇关于当response.buffer = True时,ASP VBScript失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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