When you debug does your controller get hit? I'm not sure if Url.Action works with a SurfaceController.
You could try route hijacking. Than you do your logic in the controller, update the model and pass that to the view. I have many route hijacking examples in the Hybrid Framework.
The reason I'm trying to use a controller is because the original way someone programmed in (6.1.6) no longer works do you have any ideas why this could be?
Getting Image from database using a Surfacecontroller
Hi,
I trying to get an image contained in a database through a surface controller. Anyone with any ideas?
Using Umbraco 7.2.4
My attempt below:
View
Controller
Hello,
When you debug does your controller get hit? I'm not sure if Url.Action works with a SurfaceController.
You could try route hijacking. Than you do your logic in the controller, update the model and pass that to the view. I have many route hijacking examples in the Hybrid Framework.
Jeroen
Thanks Jeroen looks very useful! Is there any other way you would suggest?
Hi Jeroen,
The reason I'm trying to use a controller is because the original way someone programmed in (6.1.6) no longer works do you have any ideas why this could be?
Now using 7.2.4
Image reference
GetImages Razor
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
var id = Request["id"];
var db = Database.Open("www.???.com");
var sql = "SELECT Image, Image_ID "+
"FROM tbl_Image "+
"WHERE Image_ID = '"+id+"'";
var file = db.QuerySingle(sql);
Response.ContentType = "image/gif";
Response.BinaryWrite((byte[])file.Image);
Response.Cache.SetLastModified(DateTime.Now.AddYears(-1));
}
Thanks
For anyone interested in the previous post, I forgot to create a document type with of the name GetImages which is why it wasn't working.
is working on a reply...