Expiring cookies differently for desktop vs. channel viewers

It is fairly common for Web sites on the open Internet to expire cookies in a fairly short time, like 15 or 20 minutes. This may be done for reasons of security. If there has been no user interaction for 15 – 20 minutes, the user may have walked away from his or her computer with a browser window left open, logged into your site. To prevent another person from walking up to the computer and having full access to the user's account, you make cookies fairly quickly.

If your channel is drawing its pages from the same source as a Web site on the open Internet that expires cookies quickly, those rapidly expiring cookies could cause problems for your offline channel viewers. You would want to give your channel viewers considerably longer between interactions before you expire their cookies.

To set cookies to expire differently for desktop vs. channel viewers, you simply send different Set-cookie headers to your M-Business Sync Server vs. desktop browsers. You can identify requests from your M-Business Sync Server by examining the User-Agent header in the HTTP request. The User-Agent header sent by an M-Business Sync Server will look something like:

User-Agent: Mozilla/3.0 (compatible; AvantGo 3.2)

or

User-Agent: Mozilla/3.0 (compatible; AvantGo 5.2; FreeBSD)

When the User-Agent header looks like this, you set the cookie to expire with a longer time, tailored to channel viewers. Otherwise you keep the cookie expiring with the shorter time, which you have set up for desktop viewers.