[原创]实现asp与asp.net共享session
案例:
以访问asp网站页面记录
时,同时实现夸平台asp.net网站记录session;(顺序并不太重要)
asp页面:
![](https://www.cnblogs.com/Images/dot.gif)
Sub GetSessionASPX(str)
Response.write "<IFRAME ID=IFrame1 FRAMEBORDER=0 SCROLLING=NO SRC=""http://localhost:1259/HealthSystem/Aspxtoasp.aspx?UID="& str &"""></IFRAME>"
response.write "<script language='javascript'>" & chr(13)
response.write "window.self.location.href='index.asp';"&Chr(13)
response.write "</script>" & Chr(13)
Response.End()
End Sub
Dim userName = Request.QueryString("LoginName")
If userName == "Ljhong" Then
session(UserName) = userName
Call GetSessionASPX(userName)
Else
response.write "<script language='javascript'>" & chr(13)
response.write "alert('用户名不正确!');"&Chr(13)
response.write "</script>" & Chr(13)
End If
![](https://www.cnblogs.com/Images/dot.gif)
Aspxtoasp.aspx页面:
string tmpuname = HttpContext.Current.Request.QueryString("UID");
Session.Add("UserID", tmpuname );
Session.Add("UserID", tmpuname );