ASP Code
  Home arrow ASP Code arrow Page 2 - ASP Forms
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

ASP Forms
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 31
    2007-11-21

    Table of Contents:
  • ASP Forms
  • Cookies
  • A Baker's Dozen
  • Sessions
  • How to Store Sessions and Retrieve Them

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    At the virtual BlackBerry Technical Seminar 2008, you can ask your development questions directly of Research In Motion® (RIM) experts, and take advantage of learning opportunities designed uniquely for BlackBerry solution developers. Register Today!

    ASP Forms - Cookies


    (Page 2 of 5 )

    Cookies are truly the breakfast of champions. If you've ever watched an episode of Pig Olympics, you know what I am talking about. And if you haven't, head over to YouTube and give it a search. And while you are at it, check out a weightlifter by the name of Ronnie Coleman. Guaranteed in no time you will be shouting YEAP and LIGHTWEIGHT at the top of your lungs.

    Aside from being delicious and highly nutritious, Cookies are small files that the villainous server places on the user's computer. Take that user! Whenever the user logs back onto the web page, it sends that cookie back (who wants a used cookie?). This allows us to "remember" certain aspects about the user.

    Here is how you create a cookie in ASP:


    <%

    Response.Cookies("name")="Monster"

    %>

    This stores the name "Monster" in the name cookie. We can also determine how long the cookie will stay on the user's computer, by assigning an expiration property to it:


    <%

    Response.Cookies("name")="Monster"

    Response.Cookies("name").Expires=#April 22, 2008#

    %>

    This code creates the cookie and stores the value in it, then gives the cookie an expiration date.

    Getting a Cookie from the Cookie Jar

    It's one thing to create a cookie, but another to retrieve that cookie without getting caught by our parents at four in the morning. I mean come on: I'm thirty. Can't I have a cookie when I want one?

    We use the Request.Cookies command to jack those cookies. Here is how we retrieve a cookie and then display it for all the world to see:


    <%

    username=Request.Cookies("name")

    response.write("Leave my cookies alone you " & username)

    %>

    This would retrieve the cookie from the users computer and display the following to the screen:

      Leave my cookies alone you Monster

    More ASP Code Articles
    More By James Payne


       · how to data update,search,save in database through forms button
     

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Various methods of setting Date values to a ...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...

    Iron Speed




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway