actionresult

MvcContrib : returning an existing ViewResult does not redirect to the correct page.

I've the following scenario: Go to the /User.mvc?userId=200&otherId=1 page. Change some data. Press Update button. Show the /User.mvc?userId=200&otherId=1 page. I used MvcContrib + T4MVC with the following code: [AllRolesAuthorize()] public virtual ViewResult Index(long? userId, long? subPracticeId) { long selectedUserId = userI...

Why is this code sending 0kb files to the browser?

here is the call... return new FileUriResult("application/octet-stream", a.AssetPath, null); [note that I set content length to null because I don't know it (file is on another server)] a.AssetPath is: "http://http.cdnlayer.com/account name/folder/folder/folder/asset.mp3" (fake URL for this example but in my implementation I can bro...

Autorefresh a ActionResult?

I am using the following code to get data from database and output it as JSON: public ActionResult Map() { var map = DeviceLocation.FindAll(); Locations l = new Locations(); l.locations = map; return Json(l, JsonRequestBehavior.AllowGet); } Is there a way to make this ActionRsult auto refresh? T...

How to limit access to an [HttpGet] ActionResult in ASP.NET MVC?

Imagine I have an ActionResult like this: [HttpGet] public ActionResult Cities(string q) { //Return a list of cities that matches parameter } How do I stop all other sites apart from mine using this as if it's their own little REST-based service for getting a list of matching cities? Is checking the referrer the only way to go...

Bestpractice DI with ASP.NET MVC and StructureMap - How to inject dependencies in an ActionResult

I edited my whole question, so do not wonder :) Well, I want to have an ActionResult that takes domain model data and some additional parameters, i.e page index and page size for paging a list. It decide itself if it returns a PartialViewResult or a ViewResult depending on the kind of web request (ajax request or not). The reffered dat...