actionresult

What's the point of ActionResult return type?

Hi, What is the point of an action returning ActionResult? ...

ASP.NET MVC Folder Controller Html.ActionLink

I have the following code in my Site.Master page of an almost empty ASP.NET MVC Project. <li> <%= Html.ActionLink("Home", "Index", "Home")%> </li> <li> <%= Html.ActionLink("Feed List", "FeedList", "Home")%> </li> <li> <%= Html.ActionLink("Monitored Feeds", "MonitoredFeeds", "Home")%> </li> <li> <%= Html.ActionLink("Abo...

In MVC, how do I return a string result?

Hi, In my ajax call, I want to return a string value back to the calling page. Do I still using ActionResult or just return a string? ...

What should my JSON string look like in my Action in MVC?

Hi, in .net mvc my action looks like: public ActionResult TestAjax(string testID) { return Content(@"{first: ""1"", second : ""2""}"); } In my javascript I am doing: function(data) { alert(data.first); } I am getting [object Object] as the output, why is that? Is my JSON string wrong? ...

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 ? ...

How do I perform a secondary action (i.e. calculate fields) in ASP.NET MVC?

I need to do some calculations on an ASP.NET MVC View, an action different than the form submission. I've tried various methods of passing the current Model on to a new controller action via an ActionLink, but the model doesn't appear to be passed. public ActionResult Calculate(MuralProject proj) { ProjectFormRepository db = new Pro...

How can I redirect after ActionResult has been determined?

In ASP.NET MVC I would like to do something like: Let a base controller check for the type of the ActionResult. If the ActionResult is a ViewResult, load some shared data for all views. If the shared data fulfills some specific criteria, redirect to a login page. How would you implement that? I thought about the following, but it ...

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) { try { var path = string.Concat(Config.ImageDir, customerId, ...

How to return an XML string as an action result in MVC

I'm able to return JSON and partial views (html) as a valid ActionResult, but how would one return an XML string? ...

Can someone explain how the struts2 XSL ResultType works?

I'm trying to figure out how to use the struts2 XSL ResultType. I just can't figure out how it is supposed to work and aside from the official documentation, I've found maybe two articles online that tried to explain it (unsuccessfully for me). My understanding of how it works is I create an xsl stylesheet, then I have a struts action ...

Recommended way to create an ActionResult with a file extension

I need to create an ActionResult in an ASP.NET MVC application which has a .csv filetype. I will provide a 'do not call' email list to my marketing partners and i want it to have a .csv extension in the filetype. Then it'll automatically open in Excel. http://www.example.com/mailinglist/donotemaillist.csv?password=12334 I have succe...

What are all the available ActionResults for ASP.NET MVC?

What are all the methods that return an ActionResult in ASP.NET MVC as of right now (ie. RedirectToAction, etc.) I haven't found a good documentation resource that lists this kind of stuff. ...

A custom ActionResult for a multi-part http response?

I'd like to respond to an http request with both a txt file and an html page. This way the client can save the file and see a summary of that file's contents via an html page. Since the file is generated on the fly, I have to use state management on the server to generate the summary on the second request. I'd like to avoid this and wra...

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 gets passed to the ActionResult method is a single dimensional string array containing a str...

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

Hi, 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 and provide back an XML with the result of the action. I don't have problems sendin...

All inbuilt ActionResults in ASP.NET MVC

I'm looking for a list of the inbuilt (and 3rd party would be a bonus) ActionResults you have available to you in a controller in ASP.NET MVC. So far I've discovered the following: ContentResult - this.Content() ActionResult - this.View() JsonResult - this.Json() JavascriptResult - this.Javascript() PartialViewResult - this.PartialVi...

MVC ActionResult and QueryString

I'm a little puzzled with QueryStrings and ActionResult I have a URL coming in from jQuery as: url: "/ToBePaid/Receipt/" + $(this).attr('value') + "&receipt=" + $(this).attr('checked') which generates /ToBePaid/Receipt/28cb8260-d179-450f-b9c4-162f1cc45bbd&receipt=true and my ActionResult is as follows: public ActionResult ReceiptEx...

How to get the Jquery Autocomplete result event handler to work?

I wrote code that fails to use the JQuery autocomplete to fire a result function after the user selects something valid (below). By result, I mean result handler, a function that fires after a good selection happens in the autocomplete plugin. Documented here. In my case, I have a form that is really a table where each row is the same...

Disable Session state per-request in ASP.Net MVC

Hi, I am creating an ActionResult in ASP.Net MVC to serve images. With Session state enabled, IIS will only handle one request at a time from the same user. (This is true not just in MVC.) Therefore, on a page with multiple images calling back to this Action, only one image request can be handled at a time. It's synchronous. I'd like ...

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 a list. We've just bought the Wrox book but it's more than a week away from delivery an...