asp 和asp.net共用session

博客展示了ASP登陆页面的代码,包含页面样式和欢迎信息。还给出了C#代码处理Session,设置超时并存储表单数据。此外,提供了跳转到ASP.NET页面的代码,通过Session传递数据并提交表单。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

asp登陆页面

<style type="text/css">
<!--
body {
 background-color: #FFFFCC;
}
-->
</style><table cellspacing="1" cellpadding="2">
  <tr>
    <td>.:: 網站管理中心 </td>
  </tr>
</table>
<table cellspacing="0" cellpadding="0">
  <tr>
    <td></td>
  </tr>
</table>
<table width="664" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="center" align="middle"><strong><br>
          <br>
          <br>
          <br>
      歡迎進入系統管理中心 </strong><br>
      <br>
      <br>
      <br>
      <br>
      恭喜,恭喜! <br>
      <br>
      您已經成功登陸! <br>
      <br>
      <br>
      <br></td>
  </tr>
</table>
<table cellspacing="0" cellpadding="0">
  <tr>
    <td></td>
  </tr>
</table>
<table cellspacing="0" cellpadding="0">
  <tr>
    <td align="middle">程式設計: <a href="http://www.aaa.com">商訊科技 </a> 版本:V2.0 </td>
  </tr>
</table>
<%@ Page language="c#" %>
<script language=C# runat=server>
 private void Page_Load(object sender, System.EventArgs e)
 {
Session.Timeout = 60;
for(int i=0;i<Request.Form.Count;i++)
{
Session[Request.Form.GetKey(i)]=Request.Form[i].ToString();
}
allsession();
try
{
if( Session["DestPage"].ToString().Length >4 )
{
Server.Transfer(Session["DestPage"].ToString(),true);
}
}
catch{}
}
private void allsession()
{
Response.Write ("There are " + Session.Contents.Count +" Session <I>var</I>iables<P>");
foreach(object obj in Session.Contents)
{
Response.Write("Session["+obj.ToString()+"] - "+Session[obj.ToString()].ToString()+"<br>");
}
}
</script>

跳转到asp.net页面内的代码:

<%
    session("name")="srx"
    session("id")="1"
    session("sex")="f"
    session("pass")="asdfas"
    session("age")="23"
    session("weight")="131"
    Response.Write("<form name=frm id=frm action=""asptoaspx.aspx"" method=post >")

    for each Item  in Session.Contents
Response.Write "<input type=hidden name="&Item
Response.Write " value=" & Session(item) & " >"
    next

if len(Request.QueryString("Destpage")) >4 then
Response.Write("<input type=hidden name=DestPage value=" &   Request.querystring("DestPage") & ">")
end if
Response.Write("</FORM>")
Response.Write("<scr" + "ipt>frm.submit();</scr" + "ipt>")
%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值