I am facing a problem on setting up some cookies with asp on IE6 and IE7

I need to set following cookies when user logs in to his account.

Response.Cookies("crmadmin_login_id") = session("login_id")
Response.Cookies("crmadmin_cuser_id") = rsbrokercrm("cuser_id")
crmuserlevel = cint(rsbrokercrm("cuser_level"))
Response.Cookies("crmadmin_level") = crmuserlevel

Response.Cookies("cid") = rsbrokercrm("c_id")
Response.Cookies("company_name") = rsbrokercrm("Company_Name")

When I comment above lines the session("login_id") works properly however when i run the above code in IE6/7 (on the page where I am authenticating our user's credentials) it kills session("login_id") which is required for accessing the account. This happens when the page is redirected from authentication page to the account page. I tried another option i.e. removed above code block from authentication page and put it on account page. then the account page worked, but again when I click any other page which requires session("login_id"), it again kills the session.

Please help

They are separate cookies so an additional cookie shouldn't break anything, or affect a cookie that has just been written.

To reduce the number of cookies you can store all information in the one cookie. For example:

strCookieKey = 'MyCookieName"
response.cookies (strCookieKey)("UI") = strUsername
response.cookies (strCookieKey)("UC") = strUserCountry
response.cookies (strCookieKey)("UL") = strUserLanguage
response.cookies (strCookieKey).expires = DATE + 365 'Cookie expires in 365 days

Also, I find it best to declare and assign all variables from a database before referencing them at intervals.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.