Hai friends,
I am beginer to MVC.
I am have installed MVC 4.
I am getting problem when i executed a small program...
namespace MvcOne.Controllers
{
public class HourController : Controller
{
public string Index()
{
return "abcdefhijkl....z";
}
}
}
But it is throwing the the error as below.....
Server Error in '/MvcOne' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.Requested URL: /MvcOne/HourController/Index
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
Please solve this problem............
I am facing this problem from lot of days.

Jignesh TrivediPosted Feb 13, 2014, 11:12 PM
if you not able to find the file (view) then you have to create it.
hope this will help you.
Sreekanth ReddyPosted Feb 13, 2014, 11:05 PM
Jaganathan BantheswaranPosted Feb 10, 2014, 1:50 AM
From his code, its clear that he has missed to return a View. So there is no problem with his URL [MvcOne/HourController/Index] but the only thing is to return View.
Jignesh TrivediPosted Feb 10, 2014, 1:00 AM
hi,
Agree with Jaganathan.
Add one more point, there is also problem with your url "MvcOne/HourController/Index"
this in this case MVC Router first look MVCOne "area" and then look for controller and last action method. if any one from area, controller or action method not found than it threw error.
hope this will help you.
Jaganathan BantheswaranPosted Feb 10, 2014, 12:12 AM
If you request for a view using the URL /MvcOne/HourController/Index, then the Index action should return the Index View. But you are returning a string.
Thats why the runtime says the Resource not found. So your Index action should be like,
public string Index()
{
return View();
}
And,
You should have a Index.cshtml view under Hour folder.
boycotoPosted Feb 9, 2014, 8:13 PM