Category Archives: ASP.NET

Ways to pass information from a controller to a view in ASP.NET MVC

There are three ways to pass information from a controller to a view: As a dynamic type (using @model dynamic) As a strongly typed model object. Using the ViewBag See the sample list and three different actions for my HomeController: … Continue reading

Posted in MVC | Tagged , , | Leave a comment

Convert an oracle BLOB image (Byte[]) to base64 for web service

while (reader.Read()) {                PhotoInfos myPhoto = new PhotoInfos();                byte[] image = (byte[])reader[“image”];                int imageLength = image.Length;                string base64image = Convert.ToBase64String(image, 0, imageLength);                myPhoto.photo = base64image;                result.Add(myPhoto);                         }

Posted in ASP.NET, C# | Leave a comment

Remove the last character of a StringBuilder object

Updating data depending on the whether or not the parameters are set may cause various problems. For example, In this case, if you send only ID to set, as it will be the last parameter in the query, it may … Continue reading

Posted in ASP.NET, C# | Leave a comment