Handel _ERR_INVALID_COOKIE(Cookie) error on Login and Redirect it to another page
Open : Stores\WebContent\GenericSystemError.jsp
Search for key : _ERR_INVALID_COOKIE
try {
ErrorDataBean errorBean = new ErrorDataBean ();
com.ibm.commerce.beans.DataBeanManager.activate (errorBean, request);
if (errorBean.getMessageKey().equals("_ERR_INVALID_COOKIE"))
{
Cookie cookies [] = request.getCookies ();
Cookie myCookie = null;
if (cookies != null){
System.out.println ("Cookies Issue");
for (int i = 0; i < cookies.length; i++) {
if (cookies [i].getName().equals ("WC_USERACTIVITY")) {
myCookie = cookies[i];
break;
}
}
}
if (myCookie != null)
{
System.out.println ("Cookies Issue -Here");
myCookie.setMaxAge(0);
myCookie.setValue("");
response.addCookie(myCookie);
}
String fwhostName = "http://" + request.getHeader("host")
// To resolve append with below syntax (or) Redirect to home page
+"/webapp/wcs/stores/servlet/TopCategoriesDisplay?storeId=12556&catalogId=33057";
response.sendRedirect(fwhostName);
}
System.out.println ("ErrorDataBean:\n" + errorBean.toString()+"\n");
%>
Search for key : _ERR_INVALID_COOKIE
try {
ErrorDataBean errorBean = new ErrorDataBean ();
com.ibm.commerce.beans.DataBeanManager.activate (errorBean, request);
if (errorBean.getMessageKey().equals("_ERR_INVALID_COOKIE"))
{
Cookie cookies [] = request.getCookies ();
Cookie myCookie = null;
if (cookies != null){
System.out.println ("Cookies Issue");
for (int i = 0; i < cookies.length; i++) {
if (cookies [i].getName().equals ("WC_USERACTIVITY")) {
myCookie = cookies[i];
break;
}
}
}
if (myCookie != null)
{
System.out.println ("Cookies Issue -Here");
myCookie.setMaxAge(0);
myCookie.setValue("");
response.addCookie(myCookie);
}
String fwhostName = "http://" + request.getHeader("host")
// To resolve append with below syntax (or) Redirect to home page
+"/webapp/wcs/stores/servlet/TopCategoriesDisplay?storeId=12556&catalogId=33057";
response.sendRedirect(fwhostName);
}
System.out.println ("ErrorDataBean:\n" + errorBean.toString()+"\n");
%>
Comments
Post a Comment