asp和asp.net之间的Session是不能共享的。
解决办法是:可以通过数据库,也可以通过WebService实现,不过这都很麻烦。
Cookie共享简单的多。
asp和asp.ne的Cookie只是存储的编码格式不同,经过简单转换就可以了。
如果使用asp保存COOKIES则中文将保存成某种格式比如,“中国”保存成了:“%D6%D0%B9%FA” 。
只需要在asp.net(c#)页面做处理。
代码如下:
//在ASP.Net中保存Cookie时:

System.Text.Encoding theEncoding = System.Text.Encoding.GetEncoding("gb2312");
string cookieValue = HttpUtility.UrlEncode( "中国",theEncoding );

Request.Cookies["SomeCookie"].Value = cookieValue;
//获取Cookie时:
System.Text.Encoding theEncoding = System.Text.Encoding.GetEncoding("gb2312");
string cookieValue = Request.Cookies["SomeCookie"].Value;

string decodeValue = HttpUtility.UrlDecode(cookieValue, theEncoding);
解决办法是:可以通过数据库,也可以通过WebService实现,不过这都很麻烦。
Cookie共享简单的多。
asp和asp.ne的Cookie只是存储的编码格式不同,经过简单转换就可以了。
如果使用asp保存COOKIES则中文将保存成某种格式比如,“中国”保存成了:“%D6%D0%B9%FA” 。
只需要在asp.net(c#)页面做处理。
代码如下:
//在ASP.Net中保存Cookie时:
System.Text.Encoding theEncoding = System.Text.Encoding.GetEncoding("gb2312");
string cookieValue = HttpUtility.UrlEncode( "中国",theEncoding );
Request.Cookies["SomeCookie"].Value = cookieValue;
//获取Cookie时:
System.Text.Encoding theEncoding = System.Text.Encoding.GetEncoding("gb2312");
string cookieValue = Request.Cookies["SomeCookie"].Value;
string decodeValue = HttpUtility.UrlDecode(cookieValue, theEncoding);
浙公网安备 33010602011771号