怎样提交用户名和密码

forest is the name 2003-09-20 05:35:39
我的当前环境是iis5.0+ASP。
Web服务器上有一个目录设为基本验证。
通常情况下,在打开受保护网页前客户端会弹出登陆对话框,要求输入用户名和口令。

我的设想是,在未受保护的主页中做一个Form, 填入用户名和密码并保存下来,在需要访问保护区时,直接用程序把用户名和密码提交到服务器去验证,而不是跳出标准的windows登陆对话框。

各位有什么办法?
...全文
191 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
happylifei 2003-09-23
  • 打赏
  • 举报
回复
to wolf004(色胚)
<%
authUser=trim(request.servervariables("AUTH_USER"))
IF authUser="" Then
Response.Status="401 Not Authorized"
Response.AddHeader "WWW-Authenticate","Basic Realm="" SUPEREXPERT"""
Response.End
End if
%>

问:如果需要用户输入用户名和密码,正确才让进入页面。怎么设置。
谢谢

forest is the name 2003-09-23
  • 打赏
  • 举报
回复
dicklee1214(令狐冲)的方法还是用数据库验证,而不是Windows基本验证,不能保护txt和pdf文件,我如果知道pdf文件的url,不用密码也可以直接得到。
dicklee1214 2003-09-23
  • 打赏
  • 举报
回复
<%@ Language=VBScript %>
<%
if Request.ServerVariables("http_method")="POST" then
if Request.Form("B1")="进入"then
set conn=Server.CreateObject("ADODB.Connection")
conn.Open session("addr")
strsql="select DLMC,DLKL,QXKZ from ZJKU where DLMC='"&Request.Form("DLMC")&"'and DLKL='"&Request.Form("DLKL")&"'and CZYF=1"
set mrs=conn.Execute(strsql)
if not mrs.bof and not mrs.eof then
session("qx")=mrs(2)
if len(mrs(2))>2 then
Response.Redirect"index.htm"
else
Response.Redirect"index1.htm"
end if
else
Response.write("您的输入有误!请重新输入!")
end if
set mrs=nothing
conn.close
set conn=nothing
end if
end if
%>

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>身份验证</title>
</head>

<body bgcolor=peachpuff>

<p align="center"><b><font face="华文行楷" size="6" color="#FF0000">身份验证</font></b></p>
<form method="POST" action="default.asp">
<table border="0" cellPadding=1 cellSpacing=1 width=100%>
<tr>
<td> 
<p align="center">登录名称:<input type="text" name="DLMC" size="20"></p>
</td>
</tr>
<tr>
<td> 
<p align="center">登录口令:<input type="password" name="DLKL" size="20"></p>
</td>
</tr>
<tr>
<td> 
<p align="center"><input type="submit" value="进入" name="B1">
</td>
</tr>

</table>

</form>

</body>

</html>
session用来保存变量在不同页中传递
forest is the name 2003-09-23
  • 打赏
  • 举报
回复
用asp程序直接输入用户名和口令的方法是:
http://username:passwd@www.someweb.com
不过在打开网页的过程中,用户可以看到用户名和口令,这是我想找到其它方法的原因。
上述的方法或者是用数据库做验证,不能保护非asp文件,如txt, pdf等;
或者是通知客户端输入用户名和口令,我要的是自动帮客户填好这些消息并发送到服务器,而不用用户干预。
超级大笨狼 2003-09-23
  • 打赏
  • 举报
回复
验证通过后把用户名存到session中:
session("userid")=user_id
这样受保护的页面来判断session就可以了
我们的东西都这么做,一个incude文件,每页开头都放
dafei0320 2003-09-23
  • 打赏
  • 举报
回复
我的建议!<script language="vbscript">
sub button1_onclick()
-------------
想要实现什么作用?
-------------
end sub
</script>
boywind 2003-09-22
  • 打赏
  • 举报
回复
用Cookie行么?----我瞎说的```说错了别笑我`
forest is the name 2003-09-22
  • 打赏
  • 举报
回复
用Cookie当然不行了,如果那么简单就不用问了。
bluedesign 2003-09-21
  • 打赏
  • 举报
回复
UP
forest is the name 2003-09-20
  • 打赏
  • 举报
回复
To: yywxlb(幽悠), 你说的是验证通过后...,我要的就是那个验证。
To: wolf004(色胚),我就是不想要弹出来的窗口,而是直接验证通过。

有没有别的办法?
听说xmlhttp可能行,谁介绍介绍?
wolf004 2003-09-20
  • 打赏
  • 举报
回复
<%
authUser=trim(request.servervariables("AUTH_USER"))
IF authUser="" Then
Response.Status="401 Not Authorized"
Response.AddHeader "WWW-Authenticate","Basic Realm="" SUPEREXPERT"""
Response.End
End if
%>
这样就行了!试试
tanguangzhang 2003-09-20
  • 打赏
  • 举报
回复
关注~~!
yywxlb 2003-09-20
  • 打赏
  • 举报
回复
验证通过后把用户名存到session中:
session("userid")=user_id
这样受保护的页面来判断session就可以了

forest is the name 2003-09-20
  • 打赏
  • 举报
回复
怎么Post?

不要把它当作简答题,到目前为止,我只发现了一个答案,来自微软,是一个变通方案。
根据规范,不允许直接发送用户名和密码。

如果真的知道有什么办法,请说的详细一点。
minghui000 2003-09-20
  • 打赏
  • 举报
回复
POST

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧