singh101
asked on
difference between response.addCookie and response.setHeader
You can also choose to add cookies via response.setHeader(""Set-C ookie".... )
Why would you want to add a cookie using response.setHeader over response.addCookie? Are there any important differences of doing one over the other?
Thanks In advance
Why would you want to add a cookie using response.setHeader over response.addCookie? Are there any important differences of doing one over the other?
Thanks In advance
ASKER
I am under the assumption you can set a cookie using response.setHeader("Set-Co okie.....)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> The main difference is that a cookie has the ability to be persistent on the client machine
Thats incorrect btw, theres no difference
Thats incorrect btw, theres no difference
Eg:
response.setHeader("Conten
addCookie() method of response object is used to add the specified cookie to the response.
Eg:
response.addCookie(Cookie yourSystem);
Both are different. You can't set a cookie using setHeader. Its for passing plain Name-Value Pairs in the Header of the response.