Setting expire date and path for cookies in ASP.NET (VHB.net) : Cookie « Session Cookie « ASP.Net

ASP.Net
1. ADO.net Database
2. Asp Control
3. Collections
4. Components
5. Data Binding
6. Development
7. HTML Control
8. Mobile Control
9. Page
10. Request
11. Response
12. Server
13. Session Cookie
14. User Control and Master Page
15. Validation by Control
16. Validation by Function
17. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
ASP.Net » Session Cookie » Cookie 
Setting expire date and path for cookies in ASP.NET (VHB.net)

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Setting cookies in ASP.NET</title>
   </head>
<body>

<p>

<%
    Dim Cookie1 As New HttpCookie("Cookie1")
    Dim Cookie2 As New HttpCookie("Cookie2")
    Dim ExpiryDate As DateTime = DateTime.Now()
    ExpiryDate = ExpiryDate.AddHours(1)
    
    Cookie1.Value = "Cookie from java2s.com"
    Cookie1.Expires = ExpiryDate
    Cookie1.Path = "/"
    
    Cookie2.Values("V1""1"
    Cookie2.Values("V2""2"
    Cookie2.Values("V3""3"
    Cookie2.Expires = ExpiryDate
    Cookie2.Path = "/"
    
    Response.Cookies.Add(Cookie1)
    Response.Cookies.Add(Cookie2)
    Response.Write("Cookies written")

%>

</p>

</body>
</html>
           
       
Related examples in the same category
1. Create and retrieve Cookie data (C#)
2. Display all Cookie (C#)
3. Delete Cookie (C#)
4. Delete All Cookies (C#)
5. Setting a Cookie (VB.net)
6. Adding cache dependencies (VB.net)
7. Getting cookie values in ASP.NET
8. Write Cookie and read Cookie (VB.net)
9. Save and retrieve values in Cookie (C#)
10. Save Cookie (Vb.net)
11. Set cookie expire date (VB.net)
w__ww_.___j_a___v_a___2s___.__c_o___m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.