What is wrong with my ChildAction and razor view
ASP.NET
1
Posts
1
Posters
0
Views
1
Watching
-
I have this child action in a controller [ChildActionOnly] public ActionResult GetImage(int id) { var photo = _Db.Photozs.Single(p => p.PhotozId == id); string path = Server.MapPath("~/Photo"+photo.Url); fs = new FileStream(path, FileMode.Open); return new FileStreamResult(fs, photo.ContentType); } My razor view is : @model IEnumerable @{ ViewBag.Title = "Index"; }
@foreach (var item in Model) {

@item.Caption
}
The problem I'm having is that when I remove d ChildActionOnlyAttribute from GetImage action the image renders in the view but when I add it it does not. I want this action to b child so it cannot be invoked directly by the user. Thanks