Skip to content

Instantly share code, notes, and snippets.

@navinthenapster
Last active January 17, 2018 09:50
Show Gist options
  • Save navinthenapster/0c00d1e4e6cbecfbe6227ca4c451a173 to your computer and use it in GitHub Desktop.
Save navinthenapster/0c00d1e4e6cbecfbe6227ca4c451a173 to your computer and use it in GitHub Desktop.
Session redirect by navin
<%
response.setHeader("Cache-Control","no-cache,no-store,must-revalidate");//HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
if(session==null || session.getAttribute("user")==null){
response.sendRedirect(request.getContextPath()+"/MainController");
return;
}
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment