I would like to send some sort of token on one request and store it at the client but not have that token retransmitted on subsequent requests.
views:
43answers:
5Putting the token on the web page would "store" it on the client. If you don't want it retransmitted, this seems ideal, since it will only be stored until the browser page cache is cleared.
Maybe you should explain why you want to do this.
If you are sending the data to user in cookie then data will be retransmitted of every subsequent request.. There is no a way to send data to user in cookie but not have the data retransmitted with every subsequent request........
Might your goal be achieved with a session? You send the user a small token (a session ID) and subsequent page loads send only that session ID back to the server. You can then use the session to store (potentially much larger amounts of) data server-side.
Ways for the HTTP client to not return the cookie to the HTTP server:
- The HTTP client could have support for cookies disabled.
- The HTTP client could delete the cookie.
You can do it by manipulating the paths of the cookie and processing URLs - if you set your cookie with a path '/some/obscure/dir' then the cookie will only be included in requests to URLs starting with /some/obscure/dir