actionfilterattribute Questions
5
Solved
Taking a simple action filter, which checks if the user is logged in and retrieves their user ID.
public class LoginFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionE...
Elenaelenchus asked 9/8, 2016 at 13:34
5
I am trying to do some stuff after my controller is done with the action at OnActionExecuted.
However the method is called twice.
My filter method
public class TestFilter: ActionFilterAttribute
{...
Mannikin asked 26/11, 2013 at 14:22
3
Solved
I have an action filter that when used in certain specific conditions has to perform a web service call to ensure that the current state is valid. This initially seemed like an ideal candidate for ...
Impoverish asked 18/9, 2012 at 17:50
2
Solved
I'm looking to test an ActionFilterAttribute in a .NET Core 2.0 API project and wondering the best way to go about it. Note, I'm not trying to test this through a controller action, merely test the...
Fescennine asked 11/9, 2017 at 19:17
2
Solved
I've found a few questions on this, but they tend to point to the exact documentation I'm following... but it's still not working.
I'm building a fairly simple ASP.NET MVC 4 site, and the plan is ...
Glanville asked 28/7, 2013 at 8:15
1
Solved
I move old MVC 5 application to Core, old application has code:
public class ValidateApiModelStateAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext acti...
Bruni asked 1/12, 2018 at 18:40
7
Solved
I have set up a global filter for all my controller actions in which I open and close NHibernate sessions. 95% of these action need some database access, but 5% don't. Is there any easy way to disa...
Gunstock asked 31/3, 2012 at 6:53
1
Solved
Good day.
I'm trying to use logging by injecting a LoggerFactory in my custom ActionFilterAttribute class but when using the Attribute in one of the controller methods I get an error saying
[CS70...
Humbert asked 19/6, 2018 at 21:25
4
Solved
I am writing an Authorize filter attribute adn I'm having trouble figuring out how to get the current url as a string so I can pass it as a parameter to the LogOn action. The goal is that if a user...
Coney asked 25/5, 2012 at 21:25
1
Solved
I'd like to be able to read a Request header in an ActionFilterAttribute, and direct the user. I'd also like to maintain the existing Request, or pass the controller and URL params to the new Reque...
Peptize asked 6/7, 2017 at 21:9
1
Solved
I've setup a custom ActionFilterAttribute for my WebAPI
Is there a way to apply this to all WebAPI controllers at once, versus adding the [ActionFilter] to every single WebAPI controller?
Ocieock asked 26/6, 2017 at 15:17
6
Solved
I'm trying to implement what's seen here: http://www.piotrwalat.net/nhibernate-session-management-in-asp-net-web-api/ but I'm having an issue with my NhSessionManagementAttribute.
I've set breakpo...
Mountaineering asked 20/10, 2012 at 21:11
1
Solved
I have the following filter attribute, and i can pass an array of strings to the attribute like this [MyAttribute("string1", "string2")].
public class MyAttribute : TypeFilterAttribute
{
private ...
Heelandtoe asked 27/8, 2016 at 12:55
3
Solved
Whatever happened to the Cancel property on the ActionExecutingContext? How would one abort a RenderAction when using an ActionFilterAttribute or is there another way to skin this cat?
public ove...
Bona asked 26/1, 2010 at 11:48
2
I understand await waits for a task (an awaitable) to complete.
But I'm confused about what that actually means.
The code that doesn't work:
public async override void OnActionExecuted(HttpAction...
Sentimentality asked 19/3, 2013 at 15:0
7
Solved
Hi I`m trying to do something that seems kinda easy, and is documented that way but for some reason its not going that easy.
Basiclly I wrote something like this:
public class CacheControllAttrib...
Aiguillette asked 28/6, 2011 at 17:5
2
Solved
So I'm creating a custom ActionFilter that's based mostly on this project http://www.codeproject.com/KB/aspnet/aspnet_mvc_restapi.aspx.
I want a custom action filter that uses the http accept head...
Offing asked 14/12, 2011 at 16:41
3
Solved
Here's the setup. Say I have some action filter that needs an instance of a service:
public interface IMyService
{
void DoSomething();
}
public class MyService : IMyService
{
public void DoSome...
Benefice asked 25/8, 2011 at 14:54
1
Solved
In writing this answer, I was asked if there are guarantees about the behaviour of the ActionFilterAttribute. and I was unable to answer with confidence.
In particular, are all four of the methods...
Noam asked 20/6, 2014 at 18:52
1
Why I am not able to inject the SetterProperty via StructureMap to an MVC ActionFilter?
public class LockProjectFilter : ActionFilterAttribute
{
[SetterProperty]
public ISecurityService Securi...
Advert asked 14/11, 2013 at 12:24
2
Solved
I have a problem with an ActionFilterAttriute that is not redirecting correctly. I'm not familiar with the complete codebase, but I have seen enough to not understand what is going on.
To simplyfy...
Boltonia asked 23/8, 2013 at 12:11
2
Solved
I have a custom action filter, that inside the OnActionExecuting, depending on certain criteria, logs out a user and redirects them to the home page of the site. The (stripped back) code for the re...
Jaenicke asked 22/4, 2013 at 11:10
1
I need to access the currently logged in user in my action filter. The identity is set by a DelegatingHandler further up the chain of execution.
I can access the current IPrincipal using Htt...
Assertive asked 11/3, 2013 at 9:20
1
Solved
I have my project which uses the usual Repository pattern with Services and Unit of Work (all with Ninject injecting the dependencies from a NinjectModule), but I'm trying to access a service from ...
Quadruped asked 11/1, 2013 at 19:5
2
Solved
I created a custom Action Filter with no problem.
But I would like to modify the Action Filter to use some of the parameters actually passed to my method.
So if I have the following method:
[Htt...
Scotch asked 30/8, 2012 at 18:36
1 Next >
© 2022 - 2024 — McMap. All rights reserved.