A problem occurred during the project today:
A project needs to log on automatically. The background implements writing the user name and password to the cookie. The local test is successful, but a problem occurs when the server is deployed. You can check the automatic logon option under ie. When you log on again, you cannot obtain the set cookie value, after research, we found that the difference between local and server access is that there is no project name, that is, IP + port access for server access. After careful research, we found the solution.
When we set cookies in the background
Cookie = new cookie (name, value); cookie. setmaxage (cookietimeout); cookie. setpath (request. getcontextpath (); // the main cause of the C error is response. addcookie (cookie );
In this way, if no project name exists
Request. getcontextpath () or the value is "". In this way, the problem occurs in IE. It is easier to locate the cause and solve the problem. You can directly set path to/to solve the problem.