Questions tagged [onactionexecuted]

15 questions
14
votes
4 answers

OnActionExecuted being called twice in Web API

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 { public override void…
7
votes
2 answers

MVC Model is null in OnExecuted action filter ... or a more elegant way to set the model?

I have an ActionFilter with an override on the OnActionExecuted method. The filterContext.Controller.ViewData.Model is always null on a POST operation. I did find the following article that seems to be saying that it should not be null but this must…
Mike
  • 1,395
  • 1
  • 16
  • 26
5
votes
1 answer

Skip OnActionExecuted execution

I made an ActionFilterAttribute that has the OnActionExecuted method implemented. That means, it runs after the Action method. But, in certain condition, I want the OnActionExecuted to not be executed. How do I, from the Action method, prevent the…
Marcos Lima
  • 765
  • 1
  • 10
  • 23
2
votes
2 answers

WebAPI Temporarily Override JsonFormatter from OnActionExecuted

I'm trying to create an attribute that will serialize data return from an action differently public override void OnActionExecuted(HttpActionExecutedContext filterContext) { var content = (filterContext.Response.Content as ObjectContent); …
johnny 5
  • 16,589
  • 46
  • 82
  • 156
1
vote
1 answer

Modifying the result from ActionExecutedContext inside OnActionExecuted in web api asp.net core

I am writing custom filter in my Web API and there I want to modify the result of ActionExecutedContext inside the OnActionExecuted method. I got the result type as OkObjectResult as the action method is returning IActionResult. public void…
1
vote
1 answer

RazorEngine Dynamically Add in cshtml

I have a problem about using of RazorEngine While Creating plugin in nopcommerce. My source code in the OnActionExecuted is: public override void OnActionExecuted(ActionExecutedContext filterContext) { var m = filterContext.Result as…
Hamid N.CH
  • 47
  • 1
  • 8
1
vote
1 answer

Overriding OnActionExecuted and Getting Weird IIS Responses

So, I have an MVC 2 site on IIS 6 (wildcard application maps/aspnet_isapi.dll hack) that where we want to direct people to different URLs depending on their preferred location, let's say la.acme.com vs. nyc.acme.com. I do not want anyone to end up…
mikerennick
  • 285
  • 2
  • 15
1
vote
0 answers

Transaction Filter Exception handling ASP.NET MVC

I am using S#arp Architecture on a project, which comes with the [Transaction] attribute for Controller methods. With this, the Transaction Commit is called as a OnActionExecuted filter, meaning it occurs after exiting the Controller method scope. …
Joe
  • 565
  • 2
  • 4
  • 14
0
votes
1 answer

How to get request parameter in OnActionExecuted of action filter

As the title, is it possible to get the request parameter? I try to get it from request body, but failed, the task.Result is zero. it seems the request body is empty. Anyone can help me, it would be much appreciated. The code as below: public class…
0
votes
1 answer

How to get value of property on action model on OnActionExecuted

I need to run some code after action executed using ActionFilter based on a property in the action Model, How to get a value of the property inside OnActionExecuted? Model public class Profile { public Guid Id { get; set; } public…
Fakhry
  • 49
  • 1
  • 9
0
votes
0 answers

SQL_LITE BUSY after trying to commit a Insert into SQLITE 3 Table Javafx

After looking at Trouble inserting data in a SQLite databae, I tried to add 'c.commit();' before I leave the stage and closing the connection c. However it keeps giving me busy for some reason. Don't know if the dynamically added buttons 'addClass'…
Michael Lin
  • 11
  • 1
  • 5
0
votes
1 answer

Fire OnActionExecuted even if response is returned from OnActionExecuting

I have following ActionFilter attributes implemented for web apis: LogRequest: This logs the request and response in OnActionExecuted method. ValidateModel: This validates the model and returns BadRequest by setting Response in OnActionExecuting`…
0
votes
0 answers

Prime faces 5.2 outcome/action was executed when the jsf page loaded

This is my first PrimeFaces project, I am using Primefaces 5.2. I put some form/action in my list page roleList.xhtml such as:
cidy.long
  • 377
  • 9
  • 29
0
votes
1 answer

Is it a good idea to put content access logic in a BaseController?

I'm developing an ASP.NET MVC application where the content for any page can be pulled from the database, if it exists, and displayed on the page. This is to make it possible for non-technical persons to edit the content without having to go into…
Jonathan
  • 29,612
  • 37
  • 126
  • 201
-2
votes
1 answer

Run a method if tab is clicked

I would like to run a function when a Tab is clicked. I tried to do this in my fxml but I think Tabs do not have an onAction property to call. So I get this error when I run the…
Ricky
  • 187
  • 10