• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SendRedirect and session

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I'm having some trouble with sendRedirect. I check the session object to see if a user have access rights to a certain page.
If not, I try to redirect the user with sendRedirect. The problem is that on some pages, the browser renders the page he shouldn't have access to first, then a part of a html header, then it renders the page the user should be redirected to. If I reload the same page once more, the user is redirected correctly.
Anyone have a clue what's wrong?
This is the page I include in all my pages to limit access:

<%
if(session.getAttribute("SITEADM") == null){

response.sendRedirect("site_admin.jsp");
}else{
String adm = "";
adm = (String)session.getAttribute("SITEADM");
if(adm.equals("Ok")){

}else{
response.sendRedirect("site_admin.jsp");
}
}
%>

 
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic