asp和asp.net之间的Session是不能共享的。
解决办法是:可以通过数据库,也可以通过WebService实现,不过这都很麻烦。

Cookie共享简单的多。
asp和asp.ne的Cookie只是存储的编码格式不同,经过简单转换就可以了。
如果使用asp保存COOKIES则中文将保存成某种格式比如,“中国”保存成了:“%D6%D0%B9%FA” 。
只需要在asp.net(c#)页面做处理。
代码如下:
asp与asp.net之间的Cookie共享//在ASP.Net中保存Cookie时:
asp与asp.net之间的Cookie共享

asp与asp.net之间的Cookie共享        System.Text.Encoding theEncoding 
= System.Text.Encoding.GetEncoding("gb2312");
asp与asp.net之间的Cookie共享        
string cookieValue = HttpUtility.UrlEncode( "中国",theEncoding );
asp与asp.net之间的Cookie共享
asp与asp.net之间的Cookie共享        Request.Cookies[
"SomeCookie"].Value = cookieValue;

asp与asp.net之间的Cookie共享//获取Cookie时:
asp与asp.net之间的Cookie共享
        System.Text.Encoding theEncoding = System.Text.Encoding.GetEncoding("gb2312");
asp与asp.net之间的Cookie共享        
string cookieValue = Request.Cookies["SomeCookie"].Value;
asp与asp.net之间的Cookie共享
asp与asp.net之间的Cookie共享        
string decodeValue = HttpUtility.UrlDecode(cookieValue, theEncoding);
asp与asp.net之间的Cookie共享

相关文章:

  • 2021-09-20
  • 2021-10-20
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2021-06-18
  • 2021-05-21
  • 2022-12-23
  • 2022-02-01
相关资源
相似解决方案