ASP.NET Tutorial/Cookie/Write — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:57, 26 мая 2010
Save value to cookie and read them back (VB)
<%@ Page Language="VB" %>
<script runat="server">
sub Page_Load(Sender as Object, e as EventArgs)
dim strVariable as string
"set up some cookie variables
Response.Cookies("temp").Value = "HI"
Response.Cookies("myCookie")("Username") = "Chris"
Response.Cookies("myCookie")("Preference") = "800x640"
Response.Cookies("myCookie")("Password") = "CookiesRock"
Response.Cookies("myCookie")("LastVisit") = DateTime.Now.ToString
Response.Cookies("myCookie")("UserAgent") = Request.ServerVariables("HTTP_USER_AGENT")
for each strVariable in Response.Cookies("myCookie").Values
Label1.Text += "<b>" & strVariable & "</b>: " & _
Request.Cookies("myCookie")(strVariable) & "<br>"
next
end sub
</script>
<html><body>
<form runat="server">
<asp:Label id="Label1" runat="server"/>
</form>
</body></html>