MVC view path from VisualStudio fails

When I right click on my view file (RetrieveReport.cshtml) and select "Properties" I find the "Browse to URL" property has this value: "~/Reports/HtmlReport/RetrieveReport"

Then when I try to do this in my controller:

return View("~/Reports/HtmlReport/RetrieveReport");

I get:

The view '~/Reports/HtmlReport/RetrieveReport' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Reports/HtmlReport/RetrieveReport

That seems messed up since that is verbatim what VisualStudio told me to put in there!

I tried returning views with all of these paths:

~/Reports/HtmlReport/RetrieveReport.cshtml HtmlReport/RetrieveReport /Reports/HtmlReport/RetrieveReport Reports/HtmlReport/RetrieveReport RetrieveReport

None of them succeed. I thought at one point RetrieveReport was working, but now it seems to not be working.

In case it helps at all, the location on the file system is:

C:\Users\micah_000\Desktop\source_11_19_2014\GideonWeb\Areas\Reports\Views\HtmlReport\RetrieveReport.cshtml

In my solution explorer the file is at:

Areas -> Reports -> Views -> HtmlReport -> RetrieveReport.cshtml

Answers


After seeing this work elsewhere in our codebase this worked for me:

~/Areas/Reports/Views/HtmlReport/RetrieveReport.cshtml

Still don't know why VisualStudio was pointing to a dead end ...


Need Your Help

converting value types of an object to Dictionary<string, string>

c# .net linq c#-4.0 reflection

How do I iterate through all the value types of an object and convert that into a Dictionary? I was heading the reflection way

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.