Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is a cookie

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 122
    Comment on it

    It is a small file in a text format and it contains no executable code and has all the information in plain text. Browser stores the cookie file in the users work machine. These cookies are sent to the server with each request that follow a set of constraints. The cookie information is used by the server to identify an individual browsing the web site. After we login a website with valid credentials a cookie is set, and we can then navigate to all the pages of the site until the cookie does not expires. Cookie helps the server to make the difference between two requests from the same browser


    Parameter of cookies and their meaning:

    1-First parameter is the value it specifies the cookie name

     The value of a cookie is stored in an HTTP header called Cookie i.e Cookie: value


    2-The expires option

    After value the first optional parameter is expires, it indicates that the cookie should not be sent to the server now and hence it must be deleted by the browser. This optional parameter have the following format. Wdy, DD-Mon-YYYY HH:MM:SS GMT such as:

    Example:
    Set-Cookie: name=abcd; expires=Sun, 10 January 2016 20:20:25 GMT
    

    3- The domain option

    The domain option specifies the domain(s) on which the cookies are sent. By default, the host name is set as domain name, so whenever a request is made to a host name the cookie values are sent .

    For example, if the domain for a cookie is set the site www.firstexample.com
    Set-Cookie: name=abcd; domain=firstexample.com
    

    4-The path option

    The path parameter specifies the URL path that is mentioned in the requested resource while the cookie header is sent. Here the comparison is done by comparing the value of the path parameter with requested URL character-by-character .The Cookie header is sent once the characters match.

    Example:
    Set-Cookie: name=abcd; path=(/userprofile/documents/) 
    

    Here the path comparison is done if the domain option is valid.


    5-The secure option

    The secure option is used for the security point of view as it contains information that could be damaged. A cookie sent to the server is secure when the request is made using HTTPS/SSL protocol.

    Example:
    Set-Cookie: name=abcd; secure;
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: