Questions tagged [actionresult]

The value returned by the Struts 2 Action class method when it completes.

The value returned by the Struts 2 Action class method when it completes. Actually, it returns a String type value. The value of the String is used to select a result element of the configuration. An action configuration will often have a set of result configurations representing different possible outcomes. A standard set of result tokens are defined by the Action interface are:

String SUCCESS = "success";
String NONE    = "none";
String ERROR   = "error";
String INPUT   = "input";
String LOGIN   = "login";

Further details are available: http://struts.apache.org/release/2.3.x/docs/result-configuration.html

457 questions
7
votes
3 answers

Can you apply an ActionFilter in ASP.NET-MVC on EVERY action

I want to apply an ActionFilter in ASP.NET MVC to EVERY action I have in my application - on every controller. Is there a way to do this without applying it to every single ActionResult method ?
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
7
votes
2 answers

Download file from ajax and ActionResult

I want to download files on browser with ajax and ActionResult. The file is downloaded and returned from my ActionResult. I see the Http query is ok and see the data in the response body. The problem is that the file is not proposed to save in the…
Gobelet
  • 453
  • 2
  • 7
  • 18
7
votes
2 answers

Struts 2.3 - redirect vs redirectAction

What is the main difference between redirect and redirectAction in Struts2.3 context. I have seen below URLs for redirect and redirectAction. I am clear about below points: redirect is like sendRedirect() method. New request is created which clear…
Jaikrat
  • 1,124
  • 3
  • 24
  • 45
7
votes
3 answers

MVC - use C# to fill ViewBag with Json Action Result

I have an MVC website with C# code behind. I am using an ActionResult, that returns Json. I am trying to put something in the ViewBag but it doesn't appear to work. The code looks like this - public ActionResult GetStuff(string id) { …
A Bogus
  • 3,852
  • 11
  • 39
  • 58
6
votes
3 answers

MVC3 - Ajax loading icon

I would like to show an AJAX loading icon during an ActionResult request that can take a few seconds to process. What is the best approach to accomplished this? I only want to display the icon after the built it validation passes (I am using MVC3,…
mp3duck
  • 2,633
  • 7
  • 26
  • 40
6
votes
3 answers

Can I return an action result from an action filter?

Usually I am validating my model in the action method before committing data to the database. [HttpPost] public ActionResult MyActionMethod(MyModelType model){ if (ModelState.IsValid){ //commit changes to database... return…
Adrian Grigore
  • 33,034
  • 36
  • 130
  • 210
6
votes
0 answers

Can preview a XLSX or XLS in browser?

I have a MVC ActionResult controller that download the file. If is PDF then using this JS code var $obj = $(''); $obj.attr("type", "application/pdf"); $obj.attr("data", myurl); $("#id").append($obj); Then i can…
GomuGomuNoRocket
  • 771
  • 2
  • 11
  • 37
6
votes
1 answer

How Can convert System.Net.Http.HttpResponseMessage to System.Web.Mvc.ActionResult

I'm Writing simple proxy application which get "URL Address" like "/xController/xMethod" and get result from another web application by HttpClient and show result. My Method: public ActionResult Index(string urlAddress) { var data = ""; if…
6
votes
2 answers

RedirectToAction() vs. View() and the ternary operators?

when deciding on which ActionResult to return from a Controller Action I decided to use the ternary operators as opposed to the lengthier if-else. Here is my issue... this code works return ModelState.IsValid ? (ActionResult)…
Derrick W
  • 312
  • 3
  • 16
6
votes
1 answer

How to pass multiple parameters in Url.Action()

I want to pass multiple parameters from Url.Action, Here is code in view window.location.href = "@Url.Action("ABC", "XYZ", new { @A= ViewBag.A , @B = ViewBag.B })"; And this is my Method in Controller XYZ public ActionResult ABC(string A, string…
Affan Shahab
  • 838
  • 3
  • 17
  • 39
6
votes
2 answers

MVC Equivalent of Page_Load

I have a session variable that is set in my MVC application. Whenever that session expires and the user tries to refresh the page that they're on, the page will throw an error because the session is not set anymore. Is there anywhere I can check to…
Turp
  • 708
  • 3
  • 14
  • 26
5
votes
2 answers

Unit test or runtime ActionResult string output response via ExecuteResult?

The Question... What is the best way to Unit Test the string response and content type from several Controller methods? Using... Each method returns an ActionResult, some of which are ViewResult responses. I'm using ASP.NET MVC 2 RTM and…
Dean Taylor
  • 40,514
  • 3
  • 31
  • 50
5
votes
1 answer

Return int from MVC Action with Ajax.BeginForm

Whats the simplest way of just returning an int from an Ajax MVC Action call? I am currently trying: public ContentResult Create(MyModel model) { return Content("1"); } using (Ajax.BeginForm("Create", new AjaxOptions { …
fearofawhackplanet
  • 52,166
  • 53
  • 160
  • 253
5
votes
7 answers

How can I optimize this actionresult for better performance? I need put put a timer on when to "GET" XML data from a url and etc

I have a actionresult that I think is pretty heavy, so I wonder how can I optimize it so it gets better performance. This web application will be used for by +100, 000 users at same time. Right now my Actionresult does the following…
Obsivus
  • 8,231
  • 13
  • 52
  • 97
5
votes
1 answer

How to handle FileStream return type in .ajax post?

I am sending JSON object through following code.. Controller returning values in CSV format that should be provide promt to open or save as CSV file. I unable to understand that what exactly code should be write in success: function (result) Link…
Pradeeepk
  • 83
  • 1
  • 6
1 2
3
30 31