ASP表单变量

时间:2009-10-21 22:49:46

标签: html forms asp-classic

我正在寻找一种安全的方式来接受表单中的用户名和密码,并且在他们成功登录后,我想将一段信息用于后续查询。

<form METHOD="POST" action="2.asp">
  <blockquote>
    <table>

      <tr>
    <th ALIGN="right" nowrap><em><font size="2">User ID:</font></em></th>
    <td><input NAME="UID" VALUE=<% if Session("UserId") = empty then
Response.Write(chr(34) & " " & chr(34) )
else
Response.Write(Session("UserId"))
end if
%> SIZE="20" MAXLENGTH="25" tabindex="4"></td>
  </tr>
        <tr>
   <tr>
    <th ALIGN="right" nowrap><em><font size="2">First Name:</font></em></th>
    <td><input NAME="FN" SIZE="20" tabindex="10"></td>
  </tr>
  <tr>
    <th ALIGN="right" nowrap><em><font size="2">Last Name:</font></em></th>
    <td><input NAME="LN" SIZE="20" tabindex="11"></td>
  </tr>

    <th ALIGN="right" nowrap><em><font size="2">Password:</font></em></th>
    <td><input NAME="PW" SIZE="20" tabindex="6"></td>
  </tr>
  </table>
  </blockquote>
  <p><input TYPE="SUBMIT" VALUE="Return UserInfo" name="cmdExec"> </p>
</form>

2.asp代码段:

<%@language=vbscript%>
<!--#INCLUDE FILE ="i_common.asp" -->
<%
  Response.Expires=0
 Response.Buffer=true
 Response.Clear
%>
<html>

<head>
<title>Transaction 10</title>
</head>

<body bgcolor="#FFFFCC">
<%
 Dim trans0009
Set trans0009 = server.CreateObject("webcom.Trans0009")
trans0009.DebugFlag= True
trans0009.AspPage= Request.ServerVariables("SCRIPT_NAME")
    if(Request.Form("PW") <> empty) then
trans0009.Password= Request.Form("PW")
end if
if(Request.Form("email") <> empty) then
trans0009.Lname=Request.Form("LN")
end if
 %>
<p align="center"><b><font size="5" bgcolor="#FFFFFF" color="#000080">Return       
 Values</font></b></p>
<hr>
<p align="left">Welcome <% Response.Write(trans0009.GetValue("Fname",0)) %><%     
 Response.Write(trans0009.GetValue("Lname",0)) %><br />
<p>

我希望{L}信息完成Post,而不需要进行三次查询。有没有办法在不暴露查询中使用的信息的情况下做到这一点?

2 个答案:

答案 0 :(得分:2)

如果您通过HTTP“明确地”发送参数,那么任何可以嗅探您的数据包的人都能够读取您发送的内容。这意味着所有人必须做的就是拦截用户发送的文本,然后将自己的POST制作到服务器上以模仿它们。

您可以设置一个challenge-response类型的系统,但仍然会有一些来回(因为这就是质询 - 响应的工作方式)。

执行此操作(我知道)的最佳方法是通过TSL (SSL)通过HTTPS。

对于后续查询,只发送服务器端信息。每当您将秘密信息传递回客户端时(未加密时),它都会再次显示,并且很容易被其他人阅读。

答案 1 :(得分:1)

以安全的方式执行此操作的唯一方法是使用HTTPS将密码保存在前往服务器的路上。

如果您可以控制webcom组件,并且出于某种原因无法使用HTTPS,那么您需要修改组件以发出挑战,而不是接受密码。

可以使用SHA1哈希的js实现,您可以使用客户端来响应挑战。

相关问题