曲径通幽论坛

标题: Request 对象中的 TotalBytes 属性 [打印本页]

作者: easy    时间: 2013-4-5 01:01
标题: Request 对象中的 TotalBytes 属性
TotalBytes 属性表示客户端在请求正文中发送的字节总数。

BinaryRead 方法检查客户端发送到服务器作为 POST 请求的一部分的数据。

TotalBytes 的测试代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<[email=%@LANGUAGE=]%@LANGUAGE="VBSCRIPT[/email]" CODEPAGE="65001" %>
<form name="myform" method="post" action="">
<input type="text" name="textfield">
<input type="submit" name="Submit" value="SUBMIT">
</form>

<%
response.Write("传送的字节数:" & request.TotalBytes)
%>
</body>
</html>
显示页面:
[attach]1508[/attach]
在这里,填入的是 123456 这 6 个字符,然后点击“SUBMIT" 提交按钮,最后得到传送的字节数为 30 个字节。为什么是 30 个字节,从何而来?
POST 提交的内容是这样的:textfield=123456&Submit=SUBMIT 。可以数一下,这里的内容共 30 个字节。我们可以使用嗅探器之类的工具,或者是一些浏览器,如 firefox 自带的相关插件捕获。




欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2