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
15
votes
4 answers

How to pass List in Redirecttoaction

I want to pass more then one parameter from RedirectToAction method how can I pass? My One Action Method [HttpPost, ActionName("SelectQuestion")] public ActionResult SelectQuestion(string email,List model) { …
Ajay
  • 6,418
  • 18
  • 79
  • 130
14
votes
1 answer

Difference between FileStreamResult and FilePathResult?

I have a simple controller which returns images: public class ImageController : Controller { [AcceptVerbs(HttpVerbs.Get)] [OutputCache(CacheProfile = "StationeryImageCache")] public FileResult Show(int customerId, string imageName) …
Sailing Judo
  • 11,083
  • 20
  • 66
  • 97
14
votes
2 answers

What are all the ASP.Net MVC Action Results?

Is there a list of all the ASP.Net MVC action results and their uses? I've been busily using ActionResult for almost everything but I know that's not correct and that I should be using more specific action results. I've Googled this but cannot find…
griegs
  • 22,624
  • 33
  • 128
  • 205
11
votes
4 answers

MVC Controller Using Response Stream

I'm using MVC 3 I would like to dynamically create a CSV file for download, but I am unsure as to the correct MVC orientated approach. In conventional ASP.net, I would have written something like: Response.ClearHeaders(); Response.ContentType =…
Neilski
  • 4,385
  • 5
  • 41
  • 74
11
votes
1 answer

Convert HttpResponseMessage to ActionResult in Dot Net Core proxy controller action

The following method is intended to accept an Http method and url, execute the method against the url, and return the resulting response to the caller. It returns ActionResult because there are error conditions that need to be handled. At present,…
Larry Lustig
  • 49,320
  • 14
  • 110
  • 160
11
votes
7 answers

How to pass XML as POST to an ActionResult in ASP MVC .NET

I am trying to provide a simple RESTful API to my ASP MVC project. I will not have control of the clients of this API, they will be passing an XML via a POST method that will contain the information needed to perform some actions on the server side…
Freddy
  • 3,064
  • 3
  • 26
  • 27
11
votes
6 answers

How do I pass a Dictionary as a parameter to an ActionResult method from jQuery/Ajax?

I'm using jQuery to make an Ajax call using an Http Post in ASP.NET MVC. I would like to be able to pass a Dictionary of values. The closest thing I could think of was to pass in a multi-dimensional array of strings, but the result that actually…
Chris Pietschmann
  • 29,502
  • 35
  • 121
  • 166
10
votes
2 answers

MVC3 Redirect to route from ActionResult

So I have a HttpPost only ActionResult called Edit. After doing its thing (logic etc), I want it to redirect to a different controller. Lets say the HomeController. Here it is: [HttpPost] public ActionResult Edit(Chair chair, string xml) { if…
Kasper Skov
  • 1,954
  • 10
  • 32
  • 53
10
votes
2 answers

How can I create a search functionality with partial view in asp.net mvc 4

I am using ASP.NET MVC 4 with entity framework model first. In my "Masterpage.cshtml" I want to have a partial view which contains a textbox and a button. The search is looking for the items title, if the text contains a items title it should…
Obsivus
  • 8,231
  • 13
  • 52
  • 97
9
votes
1 answer

How to return ActionResult along with async foreach and IAsyncEnumerable

I have a controller method of this signature: public async IAsyncEnumerable Get() It works fine but I need to do some request validation and return 401, 400, and other codes accordingly, which it does not support. Alternatively, the…
9
votes
4 answers

Insufficient stack to continue executing the program safely. ASP.NET MVC 4

My search functionality seems to continue in a infinite loop, everytime my debug hits the action below the POST actionresult gets fired. In my Masterpage.cshtml I have following action:
  • @Html.Action("Search", "Search")
  • This is the part…
    Obsivus
    • 8,231
    • 13
    • 52
    • 97
    8
    votes
    3 answers

    Should I make my ASP.NET MVC controller actions virtual?

    File -> New Project for ASP.NET MVC projects used to generate controllers with virtual actions. I'm not sure if that stopped with MVC 2 or MVC 3, but is this no longer a best practice?
    kenwarner
    • 28,650
    • 28
    • 130
    • 173
    8
    votes
    3 answers

    C# Async Task return Object

    I am trying to make usage of the IActionResult interface to throw specific exceptions. But at this moment I am stuck at the controller. I've written the following code to get a single call: [Route("singlecall")] [HttpGet] …
    zerk
    • 516
    • 4
    • 9
    • 34
    8
    votes
    3 answers

    ASP.NET MVC: How to covert an ActionResult to string?

    I would like to take an existing action method, render its return value to a string and ship it as a JSON for a response to an AJAX request. To do this, I need to render an ActionResult to a string. How do i do this? We have the opposite where we…
    burnt1ce
    • 14,387
    • 33
    • 102
    • 162
    8
    votes
    2 answers

    Access TempData in ExecuteResult Asp.Net MVC Core

    I wanted to save notification in TempData and shown to user. I create extension methods for this and implement a class which Extends from ActionResult. I need to access TempData in override ExecuteResult method with ActionContext. Extension Method: …
    Ahmar
    • 3,717
    • 2
    • 24
    • 42
    1
    2
    3
    30 31