asp.net - Show links according to rights in MVC3 -



asp.net - Show links according to rights in MVC3 -

i m working on mvc 3 application , contain different links , want show links according roles or rights. if link admin thn link shouldnt visble members right users.

how accomplish thing in mvc ?

thanks

if you're not using asp membership, way, supposing role using username , role included in model:

@{ usercontext userdb = new usercontext(); var user = userdb.usermodels.firstordefault(x => x.username.equals(user.identity.name)); if(user.role == "admin") { @actionlink("link's name","someaction", "somecontroller"); } }

crude sample if you're looking for.

asp.net asp.net-mvc security asp.net-mvc-3

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -