注册 登录
编程论坛 ASP技术论坛

新手求助

chicwolf 发布于 2008-09-10 11:46, 573 次点击
我已经做好了登陆页面,验证数据库中的用户也通过,然后打开正式页面.

可是这样以来我想那下次我不通过登陆页面,直接在浏览器输正式页面,也可运行,

这样登陆页面就只能用第一次,成了摆设了,怎么办?
7 回复
#2
yms1232008-09-10 12:19
正式页面加Session判断就可以
#3
chicwolf2008-09-10 12:24
老大,能不能稍微详细点,我实在是比较新手.
#4
yms1232008-09-10 12:28
login.asp
<%
 '登陆代码
 Session("UserName")="abc"
%>

index.asp
<%
   if Session("UserName")="" Then
      Response.Write "abc没登陆"
   Else
      Response.Write "abc已登陆"
   End If
%>
#5
chicwolf2008-09-10 12:41
不会用,唉.不好意思.我的实际登陆代码
<td width="59%"><input type="text" name="id" size="20" value="<%=id%>"></td>
<%
'登陆代码
Session("UserName")="abc"
%>
这个是放在登陆页,那么abc是什么,应该是我的form提交的字符?还是定义的name?   session里面的username是哪里的?

[[it] 本帖最后由 chicwolf 于 2008-9-10 12:43 编辑 [/it]]
#6
chicwolf2008-09-10 12:43
index.asp
<%
   if Session("UserName")="" Then
      Response.Write "abc没登陆"
   Else
      Response.Write "abc已登陆"
   End If
%>
用户名是一直在变的啊,我的登陆页面用的是这个语句,
<td width="59%"><input type="text" name="id" size="20" value="<%=id%>"></td>
那我该怎么写呢
#7
tianyu1232008-09-10 13:44
login.asp
<%
'登陆代码
'Session("UserName")="abc" '这里改为下一句,所谓的abc是指你的登陆的用户名
Session("UserName")=Request.form("id") '获取提交来的用户名
%>

index.asp
<%
   if Session("UserName")="" Then
      Response.Write "你还没登陆"
   Else
      Response.Write Session("UserName")&"已登陆"
   End If
%>
#8
chicwolf2008-09-10 15:10
非常感谢2位!
1