Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Can I save cookies in different folder other than the default one?

    Hi All,

    My application saves cookies by default in cookies folder (IE). BUt the problem is that few users have restrictions on their computers and automatically a scheduled task clears their cookies on daily basis. This is hectic for them to reset the cookies again.

    To resolve this issue and unburden those users, I have a set of questions?
    1) Can i save cookies in different folder and then read it from there? Logic behind is that since the scheduled task that deletes the cookies, cleans up the cookies folder, but if the cookie file related to my application is stored in different location it won't delete it and users can still see their customizations.

    2) If this can be done, then how?

    3) Other wise, is there any other alternative to cookies in such scenarios?

    4) can i have permanent cookies that cannot be deleted at all unless user wants it to?

    Thanks in advance,
    Programmer in distress

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Hi

    In answer to your questions:

    1) The cookie object does not allow saving to any other folder than the cookies folder.

    2) As answer to 1) is no this is null

    3) Your options are either to
    - save a "user options" file on their machine using the File System Object (an activeX object with all the security pop-up warnings etc that comes with using that)

    - Use an external data source (like MySQL, SQL Server, MS Access) running over the internet (or intranet) and potentially using a login script for the users to retrieve their preferences - or grabbing their details by their windows logon/ip address/etc if possible.

    - Introduce an application/script that copies the cookies out of the cookies folder before your scheduled cookie deletion task is launched and then moves them back after it has finished. Conversely you could might be able to get your scheduled task to leave your required cookies alone and delete the others?

    4) You can set the expiry date of the cookie way into the future something like:
    Code:
    var today = new Date();
    var expiry = new Date(today.getTime()+999*24*60*60*1000);
    Which would set the cookie to expire in 999 days. This would just mean the cookie doesn't expire for ages, but if there is a mass cookie deletion, it will disappear.

    Sorry for the bad news.

    Mostly it's a security risk to save cookies outside of the cookies folder, or using javascript to save a file to the user's machine elsewhere. If I were you, i would be inclined to look towards saving the user options into a database (MySQL, SQL Server, MS Access, etc) and reading them out of there, resetting the cookies en masse the first time the user visits the page and says "i'm here".

    Hope this helps

    m_n
    Last edited by martin_narg; 04-21-2005 at 03:11 PM. Reason: Dran tyops!
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #3
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Martin,

    Thanks for your input on my query "can i save cookies in different folder?" i would like u to elaborate more on the alternatives-

    1) File System Object - Can you suggest me a site that will be useful or an example.

    2) Database - demo

    3) Application script - example
    i would really be greatful.

    Thanks,
    programmer in distress.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •