visual studio 2010 - Asp.net Allow access to Admin Only -


i have admin page in secret folder , should accessed admin. way attempted creating session , check if logged in person admin. failed recognise admin. following attempted. can see went wrong? is because admin page in different folder , when created session wouldn't recognise when access admin area? if so, how can overcome this?

if (session["username"] != "admin")     {         response.redirect("~/notadmin.aspx");     }     else     {         showtables();     } 

get username via httpcontext class

    var user = httpcontext.current.user.identity.name;     if (user!= "admin")     {         response.redirect("~/notadmin.aspx");     }     else     {        showtables();     } 

in opinion sessions not work it. if application hosted on load balanced server. if server being load balanced, users lose session state information when load balancer sends request server.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -