asp.net MVC: reroute to action in custom action attribute -
i'm trying create attribute can set on controllers action in can check if user in kind of role. know standard asp.net authentication possible, i'm not using that.
so want accomplish this:
[role("admin", "superuser")] public actionresult safecourse()   i've constructed this:
public class adminattribute : actionfilterattribute {     public override void onactionexecuting(actionexecutingcontext filtercontext)     {   ans now..... want redirect user controller/action or if isn't possible view when / not in right role. i'm not in usual context (= controller) , i'm lost :)
michel
if make action filter implement iauthorizationfilter execute before other types ... in onauthorization(authorizationcontext filtercontext) set result.
something like
filtercontext.result = new redirectresult("/controller/actionyouwanttodirectto");   kindness,
dan
Comments
Post a Comment