I tried to add a shared view to Views/Shared
folder which I need to return some plain text values in some cases. Here is my shared view TextPlainView
:
@model string
@{
Layout = null;
Response.ContentType = "text/plain";
}
@Model
I tried to use it from a controller this way:
public ActionResult GetInfo(bool plain)
{
//Some code to prepare data
string result="Some data";
if (plain)
return View("TextPlainView", result);
else
return View(result);
}
I want to use this view across all controllers, so I want it to be shared.
I got this error:
The view 'TextPlainView' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/Orders/TextPlainView.aspx ~/Views/Orders/TextPlainView.ascx ~/Views/Shared/TextPlainView.aspx ~/Views/Shared/TextPlainView.ascx ~/Views/Orders/0.master ~/Views/Shared/0.master ~/Views/Orders/TextPlainView.cshtml ~/Views/Orders/TextPlainView.vbhtml ~/Views/Shared/TextPlainView.cshtml ~/Views/Shared/TextPlainView.vbhtml ~/Views/Orders/0.cshtml ~/Views/Orders/0.vbhtml ~/Views/Shared/0.cshtml ~/Views/Shared/0.vbhtml