I have an ASP.NET MVC app. In this app, I have a Controller that looks like this:
public class MyController
{
public ActionResult Index()
{
return View();
}
public ActionResult Photos(int id)
{
bool usePureImage = false;
if (String.IsNullOrEmpty(Request.QueryString["pure"]) == false)
{
Boolean.TryParse(Request.QueryString["pure"], out usePureImage);
}
if (usePureImage)
{
// How do I return raw image/file data here?
}
else
{
ViewBag.PictureUrl = "app/photos/" + id + ".png";
return View("Picture");
}
}
}
I am currently able to successfully hit the Photos route like I want. However, if the request includes "?pure=true" at the end, I want to return the pure data. This way another developer can include the photo in their page. My question is, how do I do this?