利用asp来在两个页面中,传递变量值,有几种方式,大家请补充,谢谢!
1.session传值,这种方式最安全,但如果使用过多的话,会造成服务器上的负担;
2.地址栏传值.
3.hidden隐藏域传值,这种传值方式必须得有form与method=post
4.cookie传值,这种方式我个人觉得不怎么好!
5........
------解决方案--------------------
学习...
------解决方案--------------------
ASP传递参数大全
2007-06-25 09:19
1、链接传递
<a href=delete.asp?name= <%=Request.QueryString( "name ")%> > 确认删除 </a>
<a href=bbs.ASP?title=服务经验交流&db=bbs&rightsfile=bbs.txt class= "news "> 服务经验交流 </a>
<a href=edit.asp?id= <%=id%> &db= <%=db%> &title= <%=title%> &rightsfile= <%=rightsfile%> > 编 辑 </a>
<a href=edit.asp?dlqy= <%=rs( "代理区域 ")%> &rq= <%=rs( "下单日期 ")%> > 编辑 </a>
<% response.write " 作者:匿名 <a href=disp.asp?id= "&rs( "id ")& "&db= "&db& " &title= "&title& "> 帖子主题: "&rs( "topic ")& " </a> "&rs( "time ")& " "%>
<% Response.Redirect "bbs.asp?id= "&id& "&db= "&db& "&title= "&title& "&rightsfile= "&rightsfile& " "%>
2、表单传递
<%name=Request.QueryString( "name ")
<form action=modified.asp?name= <%=name%> method=post> </form>
3、数据库传递
db=Request.QueryString( "db ")
set rs=server.createobject( "adodb.recordset ")
rs.open "SELECT * FROM "&db& " where id= "&id,Conn,1,1
rs1.Open "delete from "&db& " where id= "&id,conn,1,1
rs2.open "update "&db& " set answer=answer-1 where id= " & rs( "topid "),conn,1,1
4、输出传递
Response.Write " "&rs( "topic ")& " "
Response.Redirect "bbs.asp?db= "&db& "&title= "&title& "&rightsfile= "&rightsfile
7、conn=session( "conn ")
rs.Open "update userinfo_pbyy set 姓名= ' "&Request.Form( "name ")& " ',password= ' "&Request.Form( "pass ")& " ',userrights= ' "&Request.Form( "rights ")& " ',userid= "&Request.Form( "id ")& " where 姓名= ' "&nametemp& " ' ",conn,1,1
8、session值的定义与使用
<%name=Request.Form( "username ")
pass=Request.Form( "password ")
if name= "administrator " and pass= "bbkav31 " then
session( "pass ")= "1 "
set conn=server.createobject( "adodb.connection ")
set rs=server.createobject( "adodb.recordset ")
DBPath = Server.MapPath( "..\dbacess\yjkuop.mdb ")
conn.Open "Provider=SQLOLEDB.1;Password=test;Persist Security Info=True;User ID=sa;Initial Catalog=test;Data Source=test "
session( "conn ")=conn
end if
Response.Redirect "admin.asp "
%>
使用方法:
if session( "pass ")= "1 " then
Response.Redirect( "xsdf.asp ")
else
Response.Redirect "error.htm "
end if
%>
摘自:http://hi.baidu.com/lovoo/blog/item/9e554af449a97cdbf2d385bc.html