Server Side Cookies?

Question: Can we store cookies at the server not client. The idea is to share cookies with others. For example like a bulletin board.

Answer:Client side languages such as Javascript do not have access to the server to be able to store (or read) anything there. Client side languages also don't have access to any of the files on the local computer where it is being run except via the cookie interface which only gives access to data stored from pages on the same domain and the new localStorage option that some browsers now support. The difference between cookies and localStorage is that localStorage will be able to store a lot more than cookies. Also cookies are passed to the server each time a request is made so that server side scripts can also access the information in cookies..

If you use a server side language to create your web page (such as .NET, JSP, PHP, Coldfusion) then the page will have access to read and write to files on the server and will also have access to the cookies belonging to the visitor who is running the script. If your server has support for databases then the page would also have access to read and write database entries. The information in the files and database can be shared with other visitors but anything inside a cookie is only accessible to the visitor the cookie belongs to. So you would need to copy the information out of the cookie into a file or database on the server in order to share it with others.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow