Custom attribute on controller's action in umbraco plugin is not getting called.
Hello,
I have a plugin project where I have defined my controller class say TestController and have defined an action say TestAction having ChildActionOnly attribute. I have also decorated this action with my custom attribute say CustomAuthorizationAttribute.
When this action method is called, MVC is supposed to call the
OnAuthorization or AuthorizeCore method which is not
happening. I am not sure what is wrong in the code as this is a standard
approach to define the custom attribute for action method or there is any other procedure.
Below is the class written for custom authorization attribute
publicclassCustomAuthorizationAttribute: AuthorizeAttribute
{
public CustomAuthorizationAttribute() { }
public CustomAuthorizationAttribute(string actionName)
{
//Some logic here
}
protectedoverridebool AuthorizeCore(System.Web.HttpContextBase httpContext)
{
bool someValue = true;
//Set someValue variable as per custom authorization logic herereturn someValue;
}
}
I have also tried OnAuthorization method but it is also net getting called.
Below is the action method that uses CustomAuthorizationAttribute
However, the code for custom authorization
attribute gets called if I mark the action with [HttpPost] attribute
only. It seems this is not working for the actions marked with
[ChildActionOnly] attribute only.
I am using Umbraco
5(Jupiter) version which is completely based on MVC architecture and my
plugin DLLs are located in umbraco project under below path
App_Plugins\Packages\Plugin_Name\lib
If anyone has come across such scenario and got workaround, please provide help.
Custom attribute on controller's action in umbraco plugin is not getting called.
Hello,
I have a plugin project where I have defined my controller class say TestController and have defined an action say TestAction having ChildActionOnly attribute. I have also decorated this action with my custom attribute say CustomAuthorizationAttribute. When this action method is called, MVC is supposed to call the OnAuthorization or AuthorizeCore method which is not happening. I am not sure what is wrong in the code as this is a standard approach to define the custom attribute for action method or there is any other procedure.
Below is the class written for custom authorization attribute
I have also tried OnAuthorization method but it is also net getting called.
Below is the action method that uses CustomAuthorizationAttribute
However, the code for custom authorization attribute gets called if I mark the action with [HttpPost] attribute only. It seems this is not working for the actions marked with [ChildActionOnly] attribute only.
I am using Umbraco 5(Jupiter) version which is completely based on MVC architecture and my plugin DLLs are located in umbraco project under below path
App_Plugins\Packages\Plugin_Name\lib
If anyone has come across such scenario and got workaround, please provide help.
Any kind of pointers will be very helpful.
Thanks.
is working on a reply...