在.net的页面与asp的也面中可以传递session吗?
我有几个用.net做的页面,也有用asp做的页面,我现在要在.net页面和asp页面中传递一些session值.
请问可以实现吗?应该怎样做.
问题点数:50、回复次数:9Top
1 楼ChengKing((.net: http://blog.csdn.net/ChengKing ))回复于 2005-11-14 12:28:21 得分 5
asp与asp.net页面可以放到同一个页面中,但是它们不可以进行程序之间交互,不可以
传递信息。只可以互相链接Top
2 楼dreammaster(天涯)回复于 2005-11-14 12:32:54 得分 5
http://www.microsoft.com/downloads/details.aspx?FamilyId=8AA45BBC-6C0B-4DCF-B7B6-2F57E7C73587&displaylang=en
下载代码看看吧.Top
3 楼qugui(阿贵)回复于 2005-11-14 12:32:59 得分 5
可以,把Session放到数据库中去。Top
4 楼aicode(加勒比海盗(I Love C++))回复于 2005-11-14 12:40:12 得分 5
互相post数据流.然后接收就行了.没必要存在数据库中.Top
5 楼q_po_o(两个人)回复于 2005-11-14 12:49:27 得分 10
转贴
<TITLE>ASPPage1.asp</TITLE>
<%
' This is the page where we just set some Classic ASP Session Variables
' ASPPage2.asp is where the work is done.
Session("username")="joeblow"
session("email")="joe@blow.com"
Session("userid")=2
Session("DestPage")="Finalpage.aspx"
Server.Transfer("ASPPage2.asp")
%>
==========================================================================
<TITLE>ASPPage2.asp</TITLE>
<%
' We graf all the session variable names/values and stick them in a form
' and then we submit the form to our receiving ASP.NET page (ASPNETPage1.aspx)...
Response.Write("<form name=t id=t action=ASPNETPage1.aspx method=post >")
For each Item in Session.Contents
Response.Write("<input type=hidden name=" & Item)
Response.Write( " value=" & Session.Contents(item) & " >")
next
Response.Write("</FORM>")
Response.Write("<script>t.submit();</script>")
%>
============================================================================
<TITLE>ASPNETPage1.aspx</TITLE>
<%@ Page language="c#" %>
<script runat=server>
// We iterate through the Form collection and assign the names and values
// to ASP.NET session variables! We have another Session Variable, "DestPage"
// that tells us where to go after taking care of our business...
private void Page_Load(object sender, System.EventArgs e)
{
for(int i=0;i<Request.Form.Count;i++)
{
Session[Request.Form.GetKey(i)]=Request.Form[i].ToString();
}
Server.Transfer(Session["DestPage"].ToString(),true);
}
</script>
==============================================================================
<TITLE>FinalPage.aspx</TITLE>
<%@ Page language="c#" %>
<script runat=server>
// This page is just a "proof of concept page"...
private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("Shared Session Variable Names/Values between Classic ASP and ASP.NET:<BR>");
for (int i = 0; i < Session.Contents.Count; i++)
{
Response.Write("Assigned to \"" +Session.Keys[i].ToString()+"\"");
Response.Write(" Value: "+ Session[i].ToString() +"<BR>");
}
}
</script>
Top
6 楼jxufewbt(我的目标是5星)回复于 2005-11-14 12:53:26 得分 5
不能直接传递,因为asp中的Session与asp.net中的Session不一样Top
7 楼server_me(编程浪子)回复于 2005-11-14 14:31:28 得分 5
作为参数传递Top
8 楼jijl2001(jijl2001)回复于 2005-11-14 14:34:15 得分 5
你把信息传过去就行了Top
9 楼isline(缘清)回复于 2005-11-14 15:00:49 得分 5
不同语言或不同域下的session是不能互通的。
你可以通过.net跳转到asp的写session页面来写asp的session。Top




