愚蠢的ASP POST方法bug [英] silly ASP POST method bug

查看:64
本文介绍了愚蠢的ASP POST方法bug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这对我来说真的很奇怪。


我有一个demo.asp页面,不能传递隐藏值mr progrramer

本身使用POST方法。只有先生通过。


我创建了第二个asp文件demo1.asp并传递了mr programmer。整个

字符串(包括空格b / w mr和程序员已成功通过)。


demo.asp的代码是


<%

name = request.Form(" name")

response.Write" hello" &安培; request.Form(" name")


''如果name为空,则存储一些带有空格的字符串

''问题是之前的单词空间''先生''通过,但''程序员''不是

通过

如果len(名字)= 0那么

name =" mr programmer"

end if

%>


< form name =" test"行动= QUOT; demo.asp" method =" post">

< input type = hidden name =" name"值= LT;%=名称%GT; >

< INPUT type =" submit"值= QUOT;演示" name =" Submit">

< / form>


-----------------

代码为demo1.asp


< h1>来电演示< / h1>

< form name ="试验"行动= QUOT; demo.asp" method =" post">

< input type = hidden name =" name" value =" mr programmer" >

< INPUT type =" submit"值= QUOT;演示" name =" Submit">

< / form>

解决方案

" ramata" < RA **** @ discussions.microsoft.com>在消息中写道

news:70 ********************************** @ microsof t.com ...

这对我来说真的很奇怪。

我有一个demo.asp页面,它不能传递隐藏的值mr progrramer使用POST方法自己。只有先生通过了。

我创建了第二个asp文件demo1.asp并传递了mr programmer。整个
字符串(包括空格b / w mr和程序员已成功通过)。

demo.asp的代码是

<%
name = request.Form(" name")
response.Write" hello" &安培; request.Form(" name")
''如果name为空,则存储一些带空格的字符串
''问题是空格前的单词''mr''通过,但是''程序员'没有通过
如果len(name)= 0那么
name =" mr programmer"
end if
%>

< form name =" test"行动= QUOT; demo.asp" method =" post">
< input type = hidden name =" name"值= LT;%=名称%GT; >




你缺少报价:

< input type = hidden name =" name" value ="<%= name%">


-

Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserv...y/centers/iis/
http://mvp.support.microsoft.com/
http://www.iistoolshed.com/ - 工具,用于运行IIS的脚本和实用程序


" Tom Kaminski [MVP]"在消息中写道

news:Op ************* @ TK2MSFTNGP12.phx.gbl ...

:" ramata" < RA **** @ discussions.microsoft.com>在消息中写道

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

:>这对我来说真的很奇怪。

:>

:>我有一个demo.asp页面,它不能传递隐藏值mr progrramer到

:>本身使用POST方法。只有先生通过。

:>

:>我创建了第二个asp文件demo1.asp并传递了mr programmer。和

整个

:> string(包括空格b / w mr和程序员已成功通过)。

:>

:> demo.asp的代码是

:>

:> <%

:> name = request.Form(" name")

:> response.Write你好 &安培; request.Form(" name")

:>

:> ''如果名称为空,则存储一些带有空格的字符串

:> ''问题是空格之前的''先生'',但''程序员'是

不是

:>通过了

:>如果len(name)= 0则

:> name =" mr programmer"

:>结束如果

:> %>

:>

:> < form name =" test"行动= QUOT; demo.asp" method =" post">

:> < input type = hidden name =" name"值= LT;%=名称%GT; >



:你缺少报价:

:< input type = hidden name =" name" value ="<%= name%">


请注意这些拼写错误:

< input type =" hidden"命名= QUOT;名称"值= QUOT;<%=名称%GT;" />


-

Roland Hall

/ *这些信息的分发是希望它有用,但

没有任何保证;甚至没有适销性的暗示保证

或特定用途的适用性。 * /

Technet脚本中心 - http:// www .microsoft.com / technet / scriptcenter /

WSH 5.6文档 - http://msdn.microsoft.com/downloads/list/webdev.asp

MSDN Library - http://msdn.microsoft.com/library/default.asp


"拉马塔" < RA **** @ discussions.microsoft.com>在消息中写道

news:70 ********************************** @ microsof t.com ...

:这对我来说真的很奇怪。



:我有一个demo.asp页面,可以传递隐藏价值先生

:本身使用POST方法。只有先生传递。



:我创建了第二个asp文件demo1.asp并传递了mr programmer整个

:字符串(包括空格b / w mr和程序员已成功通过)。



:demo.asp的代码是


:<%

:name = request.Form(" name")

:response.Write" hello" &安培; request.Form(" name")



:''如果name为空,则存储一些带空格的字符串

: ''问题是在空格之前''先生''被传递,但''程序员''不是

:传递

:如果len(name)= 0然后

:name =" mr programmer"

:end if

:%>



:< form name =" test"行动= QUOT; demo.asp" method =" post">

:< input type = hidden name =" name"值= LT;%=名称%GT; >

:< INPUT type =" submit"值= QUOT;演示" name =" Submit">

:< / form>



:---------- -------

:demo1.asp代码



:< h1>调用demo< / h1>

:< form name =" test"行动= QUOT; demo.asp" method =" post">

:< input type = hidden name =" name" value =" mr programmer" >

:< INPUT type =" submit"值= QUOT;演示" name =" Submit">

:< / form>


ramata ...


添加,尽量不使用保留名称。


strName告诉变量的类型而不是保留字。一些

保留字会导致代码出现问题,但不会出现在这个问题中。


-

Roland Hall

/ *这些信息的分发是希望它有用,但

没有任何保证;甚至没有适销性的暗示保证

或特定用途的适用性。 * /

Technet脚本中心 - http:// www .microsoft.com / technet / scriptcenter /

WSH 5.6文档 - http://msdn.microsoft.com/downloads/list/webdev.asp

MSDN Library - http://msdn.microsoft.com/library/default.asp


This is really strange for me.

I have a demo.asp page, that can''t pass hidden value "mr progrramer" to
itself using POST method. Only "mr" is passed.

I created a second asp file demo1.asp and passed "mr programmer" and whole
string (include space b/w mr and programmer was passed successfully).

The code for demo.asp is

<%
name = request.Form("name")
response.Write "hello " & request.Form("name")

'' if name is empty then store some string with space in it
'' problem is the word before space ''mr'' is passed, but ''programer'' is not
passed
if len(name)=0 then
name = "mr programmer"
end if
%>

<form name="test" action="demo.asp" method="post">
<input type=hidden name="name" value=<%=name%> >
<INPUT type="submit" value="Demo" name="Submit">
</form>

-----------------
code for demo1.asp

<h1>call demo</h1>
<form name="test" action="demo.asp" method="post">
<input type=hidden name="name" value="mr programmer" >
<INPUT type="submit" value="Demo" name="Submit">
</form>

解决方案

"ramata" <ra****@discussions.microsoft.com> wrote in message
news:70**********************************@microsof t.com...

This is really strange for me.

I have a demo.asp page, that can''t pass hidden value "mr progrramer" to
itself using POST method. Only "mr" is passed.

I created a second asp file demo1.asp and passed "mr programmer" and whole
string (include space b/w mr and programmer was passed successfully).

The code for demo.asp is

<%
name = request.Form("name")
response.Write "hello " & request.Form("name")

'' if name is empty then store some string with space in it
'' problem is the word before space ''mr'' is passed, but ''programer'' is not
passed
if len(name)=0 then
name = "mr programmer"
end if
%>

<form name="test" action="demo.asp" method="post">
<input type=hidden name="name" value=<%=name%> >



You''re missing quotes:
<input type=hidden name="name" value="<%=name%">

--
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserv...y/centers/iis/
http://mvp.support.microsoft.com/
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS


"Tom Kaminski [MVP]" wrote in message
news:Op*************@TK2MSFTNGP12.phx.gbl...
: "ramata" <ra****@discussions.microsoft.com> wrote in message
: news:70**********************************@microsof t.com...
: > This is really strange for me.
: >
: > I have a demo.asp page, that can''t pass hidden value "mr progrramer" to
: > itself using POST method. Only "mr" is passed.
: >
: > I created a second asp file demo1.asp and passed "mr programmer" and
whole
: > string (include space b/w mr and programmer was passed successfully).
: >
: > The code for demo.asp is
: >
: > <%
: > name = request.Form("name")
: > response.Write "hello " & request.Form("name")
: >
: > '' if name is empty then store some string with space in it
: > '' problem is the word before space ''mr'' is passed, but ''programer'' is
not
: > passed
: > if len(name)=0 then
: > name = "mr programmer"
: > end if
: > %>
: >
: > <form name="test" action="demo.asp" method="post">
: > <input type=hidden name="name" value=<%=name%> >
:
: You''re missing quotes:
: <input type=hidden name="name" value="<%=name%">

watch those typos:
<input type="hidden" name="name" value="<%=name%>" />

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


"ramata" <ra****@discussions.microsoft.com> wrote in message
news:70**********************************@microsof t.com...
: This is really strange for me.
:
: I have a demo.asp page, that can''t pass hidden value "mr progrramer" to
: itself using POST method. Only "mr" is passed.
:
: I created a second asp file demo1.asp and passed "mr programmer" and whole
: string (include space b/w mr and programmer was passed successfully).
:
: The code for demo.asp is
:
: <%
: name = request.Form("name")
: response.Write "hello " & request.Form("name")
:
: '' if name is empty then store some string with space in it
: '' problem is the word before space ''mr'' is passed, but ''programer'' is not
: passed
: if len(name)=0 then
: name = "mr programmer"
: end if
: %>
:
: <form name="test" action="demo.asp" method="post">
: <input type=hidden name="name" value=<%=name%> >
: <INPUT type="submit" value="Demo" name="Submit">
: </form>
:
: -----------------
: code for demo1.asp
:
: <h1>call demo</h1>
: <form name="test" action="demo.asp" method="post">
: <input type=hidden name="name" value="mr programmer" >
: <INPUT type="submit" value="Demo" name="Submit">
: </form>

ramata...

to add, try not to use reserved names.

strName tells the type of variable and is not a reserved word. Some
reserved words will cause problems in your code, although not in this one.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


这篇关于愚蠢的ASP POST方法bug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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