.Net

Return String as ActionResult in ASP.Net MVC

Posted on Updated on

You can simply just use the ContentResult to return a plain text string:

public ActionResult Temp() {
return Content("Hi there!");
}

The partial view '~/Views/folder/view.cshtml' was not found or no view engine supports the searched locations. The following locations were searched:

Posted on

The partial view ‘~/Views/folder-name/view.cshtml’ was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/folder-name/view.cshtml

The following sections have been defined but have not been rendered for the layout page

Posted on

You usually get this error when you have defined a section in your master layout which may be Layout.cshtml in default scenarios, but you have not included anything for that section in your Views (which are using this master Layout).

If your _Layout.cshtml has something like this: Read the rest of this entry »

The specified cast from a materialized 'System.Int64' type to the 'System.Int32' type is not valid.

Posted on

We usually get this error when we use Raw SQL in EntityFrameWork, and try to stored returned values in List of your Custom Class. For Example:

[Continued]