使用不同的平台存储/检索cookie [英] store/retrieve cookie with different platform

查看:79
本文介绍了使用不同的平台存储/检索cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用ASP.NET存储cookie并使用ASP检索cookie值吗?



我的ASP.NET(商店)

 HttpCookie _userInfoCookies =  new  HttpCookie(  USERINFO); 
_userInfoCookies [ 名称] = Michael;
Response.Cookies.Add(_userInfoCookies);





我的ASP(检索)

< pre lang =c#><%
name = Request.Cookies( 名称
Response.Write( Cookies Name =& name)
%>





但它不起作用。任何建议?

解决方案

 HttpCookie _userInfoCookies =  new  HttpCookie(  userInfo); 
_userInfoCookies [ 名称] = Michael;
Response.Cookies.Add(_userInfoCookies);
Response.Redirect( YourPageName.aspx);



当您在pageload上检索cookie时,请调用

  string  s = Request.Cookies [  userInfo]。 


can i store the cookies by using ASP.NET and retrieve the cookie value by using ASP?

my ASP.NET (store)

HttpCookie _userInfoCookies = new HttpCookie("userInfo");
_userInfoCookies["Name"] = "Michael";
Response.Cookies.Add(_userInfoCookies);



My ASP (retrieve)

<%
 name = Request.Cookies("Name")
 Response.Write("Cookies Name=" & name)
%>



but it's not working. any advice?

解决方案

HttpCookie _userInfoCookies = new HttpCookie("userInfo");
_userInfoCookies["Name"] = "Michael";
Response.Cookies.Add(_userInfoCookies);
Response.Redirect("YourPageName.aspx");


when you are retrieving cookie suppose on pageload then call like

string s = Request.Cookies["userInfo"].Value;


这篇关于使用不同的平台存储/检索cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆