Up vote 1 down vote favorite share g+ share fb share tw.
I would like to override controller OnActionExecuting method, and I will check action and controller user has right or not. Public class BrowseController : Controller { protected override void OnActionExecuting(ActionExecutingContext filterContext) { //TODO: ask service user has right this action. //string actName = filterContext.
ActionDescriptor. ActionName; //string cntName = filterContext. ActionDescriptor.
ControllerDescriptor. ControllerName //foo(actName, cntName, userInfo) if return false go NoAccess page! //filterContext.
Result = new RedirectResult("_NoAccessRight"); base. OnActionExecuting(filterContext); } } I suppose that after user right validation filterContext. Result = new RedirectResult("_NoAccessRight"); But I could not get page "_NoAccessRight" and also ~/shared/_NoAccessRight" Could you please give idea?
Thanks. Asp. Net-mvc-3 link|improve this question asked Jul 3 '11 at 21:16Aureliano Buendia828415 100% accept rate.
You're not redirecting to an Action but a file. The simplest method would be to create an action that returns return View("_NoAccessRight") instead. – BuildStarted Jul 3 '11 at 22:15 @BuildStarted its nice idea, but I am far machine now... I will try few hours later.
Thanks. – Aureliano Buendia Jul 4 '11 at 1:26.
To help you for later public class BrowseController : Controller { protected override void OnActionExecuting(ActionExecutingContext filterContext) { filterContext. Result = new RedirectToAction("NoAccessRight"); } public ActionResult NoAccessRight() { return View("_NoAccessRight"); } }.
But when I override OnExecuting I thought that stop operation before executing. – Aureliano Buendia Jul 4 '11 at 6:59 Sorry, Edited the wrong item. Updated.
– BuildStarted Jul 4 '11 at 7:05 thanks loads, it is work now! :) – Aureliano Buendia Jul 4 '11 at 9:02 1 Omit "new" from RedirectToAction("NoAccessRight") (at least in MVC3). – James in Indy Jul 4 '11 at 16:14.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.