cookies
来源:互联网 发布:java web war包下载 编辑:程序博客网 时间:2024/05/01 17:34
<asp:label id="myRequestCookie"
style="Z-INDEX: 101; LEFT: 26px; POSITION: absolute; TOP: 22px"
runat="server" Width="220px" BorderStyle="Groove">
-----------------------------------</asp:label>
<asp:button id="btnCookies.Set"
style="Z-INDEX: 102; LEFT: 26px; POSITION: absolute; TOP: 56px"
runat="server" Width="220px" Text="Set Cookie"></asp:button>
<asp:button id="btnClearCookie"
style="Z-INDEX: 103; LEFT: 26px; POSITION: absolute; TOP: 84px"
runat="server" Width="220px" Text="Clear Cookie"></asp:button>
<asp:Button id="btnDoNothing"
style="Z-INDEX: 104; LEFT: 26px; POSITION: absolute; TOP: 112px"
runat="server" Width="220px" Text="Do Nothing"></asp:Button>
private void Page_Load(object sender, System.EventArgs e)
{
// Display the Request cookie on the page
if (Request.Cookies["TestCookie"] == null)
myRequestCookie.Text = "No cookie found";
else
myRequestCookie.Text = Request.Cookies["TestCookie"].Value;
}
private void btnCookies.Set_Click(object sender, System.EventArgs e)
{
// Set up a cookie and redirect to this page to pick it up for display
Response.Cookies["TestCookie"].Value = "Cookie is set";
Response.Cookies["TestCookie"].Expires = DateTime.Now.AddYears(30);
Response.Redirect("Example5.1.aspx");
}
private void btnClearCookie_Click(object sender, System.EventArgs e)
{
// Expire the cookie and redirect to this page to display a message
Response.Cookies["TestCookie"].Expires = DateTime.Now.AddYears(-30);
Response.Redirect("Example5.1.aspx");
}
private void btnDoNothing_Click(object sender, System.EventArgs e)
{
// Do absolutely nothing except redirect to simulate moving to another page
Response.Redirect("Example5.1.aspx");
}
http://www.codeproject.com/Articles/3106/On-The-Care-and-Handling-of-Cookies
- cookies
- Cookies
- Cookies
- Cookies
- Cookies
- Cookies
- cookies()
- Cookies
- Cookies
- Cookies
- Cookies
- Cookies
- cookies
- cookies
- Cookies
- Cookies
- cookies
- cookies
- 2012中国数据库技术大会
- 59 从可行走骨架开始开发应用
- POI实现导入多sheet表excel实现
- 在Eclipse中使用JUnit4进行单元测试(高级篇)
- 开源站点teem
- cookies
- mysql 的某种奇怪反应-中文
- shell数组和declare用法
- Graphic的学习
- Redhat Linux 5下的oracle数据库备份脚本
- C++中使用pthread_create
- ImageView点击时背景图修改(简单方法)
- topic model 发展方向
- listview android:cacheColorHint,android:listSelector属性作用