Pass image from controller and display in a view using ViewBag in ASP.NET MVC 3

后端 未结 4 1863
無奈伤痛
無奈伤痛 2021-01-18 01:57

I guess it\'s something very straight forward but I can\'t find out how to do it. In my controller I have:

 public ViewResult ShowForm()
        {
                   


        
4条回答
  •  星月不相逢
    2021-01-18 02:49

    public ActionResult ShowForm()
            {
                ViewBag.Title = Resources.ApplicationTitle;
                ViewBag.LabelStatus = Resources.Status;
                //Logo
               byte[] imgbytes =  File.ReadAllBytes(@"C:\Images\Logo.png");
               return File(imgbytes , "image/png");
            }
    
    
    Logo

提交回复
热议问题