会话变量和POST方法 [英] Session variables and POST method

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

问题描述

我正在尝试理解会话变量并在

上遇到一个问题,他们如何使用传递的数据。


我有一个HTM文件调用ASP文件并通过

GET或POST发送名称。


当我发现如果我通过GET方法发送值,

response.write(" From QueryString:"&

Request.QueryString(" usernamefromform")&"< br>< br> )


将变量很好,但是


Session(" userName")= request.Form(" userNameFromForm" ;)

response.write(" Session variable ="& Session(" userName"))


无效。


如果我使用POST方法,那么它是颠倒的。 Response.QueryString

没有得到任何东西,会话代码也有效。


为什么会这样?我似乎无法在我的ASP书中找到解释。


谢谢,


汤姆

I am trying to understand Session variables and ran into a question on
how they work with data that is passed.

I have an HTM file that calls an ASP file and sends the name either by
GET or POST.

When I find is that if I send the value by the GET method,
response.write("From QueryString: " &
Request.QueryString("usernamefromform") & "<br><br>")

will get the variable fine, but

Session("userName")=request.Form("userNameFromForm ")
response.write("Session variable = " & Session("userName"))

doesn''t work.

If I use the POST method then it is reversed. Response.QueryString
doesn''t get anything and the Session code works.

Why is this? I can''t seem to find an explanation in my ASP books.

Thanks,

Tom

推荐答案

使用method = post时,request.Form中没有任何内容。要调试

这样的事情或看到这样的事情,请使用response.write来查看发生了什么,

作为一般做法。


sTest = Request.form(" usernamefromform")

Response.WRite" sTest的值是 &安培; sTest


雷在工作


" Thomas Scheiderich" < tf*@deltanet.com>在消息中写道

新闻:40 ************** @ deltanet.com ...
When using method=post, request.Form will not have anything in it. To debug
such a thing or see such a thing, use response.write to see what''s going on,
as a general practice.

sTest = Request.form("usernamefromform")
Response.WRite "The value of sTest is " & sTest

Ray at work

"Thomas Scheiderich" <tf*@deltanet.com> wrote in message
news:40**************@deltanet.com...
我试图了解Session变量并讨论了如何使用传递的数据。

我有一个HTM文件调用ASP文件并通过GET或POST发送名称。

当我发现如果我通过GET方法发送值时,
response.write(" From QueryString:"&
Request.QueryString(") ; usernamefromform")&"< br>< br>")

将变量很好,但是会话(" userName")= request.Form(" userNameFromForm")
response.write(" Session variable ="& Session(" userName"))

不起作用。

如果我使用POST方法,那么它是相反的。 Response.QueryString
没有得到任何东西,会话代码也有效。

为什么会这样?我似乎无法在我的ASP书中找到解释。

谢谢,

Tom
I am trying to understand Session variables and ran into a question on
how they work with data that is passed.

I have an HTM file that calls an ASP file and sends the name either by
GET or POST.

When I find is that if I send the value by the GET method,
response.write("From QueryString: " &
Request.QueryString("usernamefromform") & "<br><br>")

will get the variable fine, but

Session("userName")=request.Form("userNameFromForm ")
response.write("Session variable = " & Session("userName"))

doesn''t work.

If I use the POST method then it is reversed. Response.QueryString
doesn''t get anything and the Session code works.

Why is this? I can''t seem to find an explanation in my ASP books.

Thanks,

Tom



我的意思是方法=得到!


Ray在工作


" Ray at<%= sLocation%> [MVP] QUOT; < myfirstname at lane34 dot com>写在

消息新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
I meant method=get!

Ray at work

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
使用时method = post,request.Form中没有任何内容。要
调试这样的事情或看到这样的事情,请使用response.write来查看
的内容,作为一般做法。

sTest = Request.form (" usernamefromform")
Response.WRite" sTest的值是 &安培; sTest

Ray在工作中

Thomas Scheiderich < tf*@deltanet.com>在消息中写道
新闻:40 ************** @ deltanet.com ...
When using method=post, request.Form will not have anything in it. To debug such a thing or see such a thing, use response.write to see what''s going on, as a general practice.

sTest = Request.form("usernamefromform")
Response.WRite "The value of sTest is " & sTest

Ray at work

"Thomas Scheiderich" <tf*@deltanet.com> wrote in message
news:40**************@deltanet.com...
我试图理解Session变量并遇到了关于如何处理传递的数据的问题。

我有一个HTM文件,它调用ASP文件并通过GET或POST发送名称。

当我发现如果我通过GET方法发送值时,
response.write(" From QueryString:"&
Request.QueryString(" usernamefromform") &"< br>< br>")

将变量很好,但是会话(" userName")= request.Form( " userNameFromForm")
response.write(" Session variable ="& Session(" userName"))

无法正常工作。
<如果我使用POST方法,那么它是相反的。 Response.QueryString
没有得到任何东西,会话代码也有效。

为什么会这样?我似乎无法在我的ASP书中找到解释。

谢谢,

Tom
I am trying to understand Session variables and ran into a question on
how they work with data that is passed.

I have an HTM file that calls an ASP file and sends the name either by
GET or POST.

When I find is that if I send the value by the GET method,
response.write("From QueryString: " &
Request.QueryString("usernamefromform") & "<br><br>")

will get the variable fine, but

Session("userName")=request.Form("userNameFromForm ")
response.write("Session variable = " & Session("userName"))

doesn''t work.

If I use the POST method then it is reversed. Response.QueryString
doesn''t get anything and the Session code works.

Why is this? I can''t seem to find an explanation in my ASP books.

Thanks,

Tom




" Thomas Scheiderich" < tf*@deltanet.com>在消息中写道

新闻:40 ************** @ deltanet.com ...
"Thomas Scheiderich" <tf*@deltanet.com> wrote in message
news:40**************@deltanet.com...
我试图了解Session变量并讨论了如何使用传递的数据。

我有一个HTM文件调用ASP文件并通过GET或POST发送名称。

当我发现如果我通过GET方法发送值时,
response.write(" From QueryString:"&
Request.QueryString(") ; usernamefromform")&"< br>< br>")

将变量很好,但是会话(" userName")= request.Form(" userNameFromForm")
response.write(" Session variable ="& Session(" userName"))

不起作用。

如果我使用POST方法,那么它是相反的。 Response.QueryString
没有得到任何东西,会话代码也有效。

为什么会这样?我似乎无法在我的ASP书籍中找到解释。
I am trying to understand Session variables and ran into a question on
how they work with data that is passed.

I have an HTM file that calls an ASP file and sends the name either by
GET or POST.

When I find is that if I send the value by the GET method,
response.write("From QueryString: " &
Request.QueryString("usernamefromform") & "<br><br>")

will get the variable fine, but

Session("userName")=request.Form("userNameFromForm ")
response.write("Session variable = " & Session("userName"))

doesn''t work.

If I use the POST method then it is reversed. Response.QueryString
doesn''t get anything and the Session code works.

Why is this? I can''t seem to find an explanation in my ASP books.




使用方法GET时,您可以通过
$ b访问表单值$ b Request.Querystring集合。使用方法POST时,您可以通过Request.Form集合访问

表单值。


问候,

Peter Foti



When using method GET, you can access the form values via the
Request.Querystring collection. When using method POST, you can access the
form values via the Request.Form collection.

Regards,
Peter Foti


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

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