关于asp与asp.net共享session的问题
我的登录模块是用asp写的,但是后面的页面基本上都是asp.net做的
由于需要对用户的权限进行控制,所以需要用到asp页面的session值
我在asp登录页面中加入了如下代码:
<form id = "alarm " action = "Alarm.aspx " method = "post " >
<input type = "hidden " name = "username " value = " <%session( "User_Name ") %> " />
<input type = "hidden " name = "powervalue " value = " <%session( "PowerValue ") %> " />
</form>
<form id = "cpk " method = "post " action = "cpkrf.aspx " >
<input type = "hidden " name = "username " value = " <%session( "User_Name ") %> " />
<input type = "hidden " name = "powervalue " value = " <%session( "PowerValue ") %> " />
</form>
<form id = "ntf " method = "post " action = "ntfrf.aspx " >
<input type = "hidden " name = "username " value = " <%session( "User_Name ") %> " />
<input type = "hidden " name = "powervalue " value = " <%session( "PowerValue ") %> " />
</form>
<form id = "station " method = "post " action = "station.aspx " >
<input type = "hidden " name = "username " value = " <%session( "User_Name ") %> " />
<input type = "hidden " name = "powervalue " value = " <%session( "PowerValue ") %> " />
</form>
<form id = "track " method = "post " action = "track.aspx " >
<input type = "hidden " name = "username " value = " <%session( "User_Name ") %> " />
<input type = "hidden " name = "powervalue " value = " <%session( "PowerValue ") %> " />
</form>
<form id = "latrack " method = "post " action = "lstrack.aspx " >
<input type = "hidden " name = "username " value = " <%session( "User_Name ") %> " />
<input type = "hidden " name = "powervalue " value = " <%session( "PowerValue ") %> " />
</form>
在asp.net页面中如下代码:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Session.Timeout = 30
Session.Add( "User_Name ", Request.Form( "username ").ToString)