c# - Force two ActionFilter attributes to be used in conjunction with one another -
i had 3 authorization attributes contained code check content being requested exists. decided avoid repeating myself in each, creating new attribute called quizexistsattribute
.
i wish run before other authorization attributes.
now have attribute, wish ensure original attributes using, aren't used without new attribute - because want check made before else.
my other authorization attributes rely on logic of quizexistsattribute
being performed are:
activequiztakersessionatrribute
authorizequizadminattribute
so in code using them so:
/// <summary> /// start of quiz /// </summary> /// <param name="urlid"></param> /// <returns></returns> [quizexists] // check quiz exists [activequiztakersession] // check have active session quiz [httpget] public actionresult quizquestion(string urlid) { // code here after checks }
is there way enforce activequiztakersession
used injunction (and following) quizexists
attribute?
you can set order in each attribute executed:
[quizexists(order = 1)] // check quiz exists [activequiztakersession(order = 2)] // check have active session quiz [httpget]
here's reference further:
order property of actionfilter, lowest greatest or vice versa?
Comments
Post a Comment