session值传递
现有多个页面A页面用于登录。请问如何在A页面中设置session值用于保存用户登录信息。用户名 密码等。并且如何查看该保存了的session值 。其他页面怎么去调用该session值!求达人赐教。。困扰一天了。现付A页面代码。请教怎么修改。<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/conn.asp" -->
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject (")
Recordset1_cmd.ActiveConnection = MM_conn_STRING
Recordset1_ = "SELECT * FROM dbo.student"
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("textfield"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
MM_fldUserAuthorization = ""
MM_redirectLoginSuccess = "框架.asp"
MM_redirectLoginFailed = "denglushibai.asp"
MM_loginSQL = "SELECT stu_name, stu_pwd"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.student WHERE stu_name = ? AND stu_pwd = ?"
Set MM_rsUser_cmd = Server.CreateObject (")
MM_rsUser_cmd.ActiveConnection = MM_conn_STRING
MM_rsUser_ = MM_loginSQL
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 50, MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 50, Request.Form("textfield2")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE3 {
font-size: 24px;
font-weight: bold;
color: #0000CC;
}
.STYLE4 {
font-size: 18px;
font-weight: bold;
color: #00CC99;
}
body{background-image:url(image/09b4cd507fcb0da38c5430f6.jpg);}
.STYLE6 {font-size: 12px}
.STYLE7 {color: #FF0033}
.STYLE8 {font-size: 24px}
.STYLE10 {font-size: 24px; font-weight: bold; }
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
#apDiv1 {
position:absolute;
left:290px;
top:456px;
width:66px;
height:15px;
z-index:1;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
//-->
</script>
</head>
<body>
<table width="100%" border="0">
<tr>
<td><div align="center" class="STYLE3">首页 <a href="wodexinxi.asp" target="_blank">我的信息 </a><a href="list.asp" target="_blank">电子作品区</a><a href="教学资源.asp" target="_blank"></a> <a href="教学资源.asp" target="_blank">教学资源区 </a><a href="管理员登录.asp" target="_blank">管理员</a><a href="管理员.asp" target="_blank"></a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE4">
<p> </p>
<marquee behavior="scroll" bgcolor="#FF3300" direction="right" scrollamount="3" scrolldelay="20">欢迎光临本系统!</marquee>
<p>电子档案管理系统</p>
</div></td>
</tr>
<tr>
<td><div align="center"> <span class="STYLE6"> <span class="STYLE7"> -记录我的成长记录</span></span></div></td>
</tr>
</table>
<form ACTION="index.asp" method="POST" name="form1" id="form1" onsubmit="MM_validateForm('textfield','','R','textfield2','','R');MM_validateForm('textfield','','R','textfield2','','R');return document.MM_returnValue">
<table width="100%" height="671" border="0">
<tr>
<td width="50%" height="288" valign="top"><table width="100%" border="0">
<tr>
<td width="22%">最新作品</td>
<td width="49%" onfocus="MM_validateForm('textfield','','R','textfield2','','R');return document.MM_returnValue">推荐作品</td>
<td width="29%">more>></td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td width="71%" height="40">111</td>
<td width="29%">09-1-1</td>
</tr>
<tr>
<td height="45">222</td>
<td>09-1-2</td>
</tr>
<tr>
<td height="31">333</td>
<td>09-1-3</td>
</tr>
<tr>
<td height="47">444</td>
<td>09-1-4</td>
</tr>
</table>
<p> </p>
<p> </p></td>
<td width="50%" valign="top"><table width="100%" border="0">
<tr>
<td height="24"> 电子作品搜索</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td width="51%" height="78"><label>
<div align="center">
<select name="select" id="select">
<option>==请选择学科==</option>
</select>
</div>
</label></td>
<td width="49%"> </td>
</tr>
<tr>
<td height="94"><label>
<div align="center">
<select name="select2" id="select2">
<option>==请选择类型==</option>
</select>
</div>
</label></td>
<td><label>
<div align="center">
<input type="submit" name="button" id="button" value="GO" />
</div>
</label></td>
</tr>
</table></td>
</tr>
<tr>
<td height="377" valign="top"><table width="100%" border="0">
<tr>
<td width="22%"><div align="center"><a href="register.asp" target="_parent">学生注册</a></div></td>
<td width="21%"><div align="center"><a href="zhuce.asp" target="_blank">教师注册</a></div></td>
<td width="57%"><div align="left"><a href="jiaoshidenglu.asp" target="_blank">登录</a></div></td>
</tr>
</table>
<table width="100%" height="213" border="0">
<tr>
<td height="60">用户名:
<label>
<input type="text" name="textfield" id="textfield" />
</label></td>
</tr>
<tr>
<td height="63">密 码:
<label>
<input type="password" name="textfield2" id="textfield2" />
</label></td>
</tr>
<tr>
<td><label>
<input type="submit" name="button2" id="button2" value="登录" />
</label>
<label>
<input type="reset" name="button3" id="button3" value="重置" />
</label></td>
</tr>
</table>
<p> </p>
<p> </p></td>
<td valign="top"><table width="100%" border="0">
<tr>
<td height="31">会员服务</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td height="95"><a href="wodexinxi.asp" target="_blank">我的信息>></a></td>
<td><a href="list.asp" target="_blank">我的作品>></a></td>
</tr>
<tr>
<td height="107">我的档案>></td>
<td>我的发言>></td>
</tr>
</table>
<p> </p></td>
</tr>
</table>
</form>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
在线等。。。。在线等。。在线等。。。