学校电子白板使用方法:关于asp强制刷新页面的问题

来源:百度文库 编辑:神马品牌网 时间:2024/04/20 13:18:03
查到的代码是(存在
../asp/asp_reflash.asp中)
response.AddHeader"pragma","no-cache"
response.AddHeader"cache-control","no-store"
response.AddHeader"expires","-1"
%>
但是这样的话返回原页面时候 session的值也都清空了 怎么既保留sessiond的值 又刷新页面
源代码太多 粘一部分

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../asp/asp_reflash.asp"-->
<html>
<head>
<title>无标题文档</title>
</head>
<body>

<%
'验证身份,并且给于不同权限
'连接数据库
sqladmin="select a.admin_gongzi,a.admin_zuanye,a.admin_zhanghao,a.admin_mima,a.admin_quanxian,teach.teach_name from admin as a,teach where admin_gongzi=teach_gongzi"
opentypeadmin="1"
%>
<!--#include file="../asp/asp_linkadmin.asp" -->'连接数据库的 用到了 sqladmin和opentypeadmin
<%'比较帐号与密码,返回session值
do while not rsadmin.eof
if trim(request.form("admin_zhanghao"))=rsadmin("admin_zhanghao") and trim(request.form("admin_mima"))=rsadmin("admin_mima") then
if rsadmin("admin_quanxian")="super" then
session("quanxian")="super"
session("name")="super"
session("gongzi")="super"
session("zuanye")="all"
welcome="你好,超级管理员"
exit do
elseif rsadmin("admin_quanxian")="normal" then
session("quanxian")="normal"
session("name")=rsadmin("teach_name")
session("gongzi")=rsadmin("admin_gongzi")
session("zuanye")="all"
welcome="你好,"&session("name")&"老师"
exit do
elseif rsadmin("admin_quanxian")="user" then
session("quanxian")="user"
session("name")=rsadmin("admin_zuanye")&"_user"
session("gongzi")="user"
session("zuanye")=rsadmin("admin_zuanye")
welcome="你好"
exit do
end if
else
session("quanxian")="wrong"
session("name")="wrong"
session("gongzi")="wrong"
session("zuanye")="wrong"
welcome="你的帐号或者密码错误"
end if
rsadmin.movenext
loop
%>
<%
response.write("session('name')"&session("name")&"<br>")
response.write("session('quanxian')"&session("quanxian")&"<br>")
response.write("session('gongzi')"&session("gongzi")&"<br>")
response.write("session('zuanye')"&session("zuanye")&"<br>")
response.write(welcome)&"<br>"

%>
<%
if session("quanxian")="user" then '当用户是普通学生时 列出上传表%>
<form action="update.asp" method="post" enctype="multipart/form-data" name="updateform">
<label>上传作业
<input type="file" name="updatefile">
</label><p>
<label>教师姓名
<select name="teach_name" style="width:auto">
<%
rsadmin.movefirst
do while not rsadmin.eof
%>
<option value=<%=rsadmin("admin_gongzi")%> selected><%=rsadmin("teach_name")%></option>

<%
rsadmin.movenext
loop%>
</select>
</label>

<p>
<input type="submit" name="Submit" value="确定">
</form>
<%
response.end
我来说一下为什么要刷
这个页面有删除文件的功能 删掉以后 按返回 文件虽然删掉了 但是链接仍然还在 就是说页面因为被缓存 刚才的操作没有正确显示 只有刷新一下才可以 总不能让别人手动刷新吧

试下JAVASCRIPT脚本
window.location.reload();

刷新页面的意义何在?

刷新后还是原来的,有必要刷新吗?我觉得这是你写程序时的逻辑错误。
如果是想定时刷新当前页面,可以这样:
<script language="javascript">
setTimeOut(1000,"location='thisurl.asp';","javascript");
</script>