十天学会ASP.net之第十天

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

Session["username"])="aa";

---------------------
Session("username")="aa"

 

读取一个SESSINN:

stringusername=Session["username"];

-------------------------
dimusername=Session("username")

再来看一下COOKIE的写入:
DateTimedt=DateTime.Now;//需要<%@ImportNamespace="System"%>,得到当前时间
HttpCookiemycookie=newHttpCookie("logname");//申明新的COOKIE变量
mycookie.Value="aa";//赋值
mycookie.Expires=Convert.ToDateTime(dt+TimeSpan.FromDays(1));//设定过期时间为1天
Response.Cookies.Add(mycookie1);//写入COOKIE

-------------------------------
dimdtasDateTime
dt=DataTime.Now
dimmycookieasHttpCookie
mycookie=newHttpCookie("logname")
mycookie.Value="aa"
mycookie.Expires=Convert.ToDateTime(dt+TimeSpan.FromDays(1))
Response.Cookies.Add(mycookie1)
 

看一下COOKIE的读取:

HttpCookiemycookie=Request.Cookies["username"];
stringusername=mycookie.Value;

-----------------------
dimmycookieasHttpCookie
mycookie=Request.Cookies["username"]
dimstring=mycookie.Value

 

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭