Click here to Skip to main content
14,836,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When ASP.NET MVC 2 couldn't find a particular view page, it will throw an exception something as below which shows that the view engine looks up the view page twice under ~/Areas/Notices/Views/ folder. But why? Is this a bug in the view engine, thanks.

Server Error in '/ISS' Application.
--------------------------------------------------------------------------------

The partial view 'NoticeView' was not found. The following locations were searched:
~/Areas/Notices/Views/NoticesSettings/NoticeView.aspx
~/Areas/Notices/Views/NoticesSettings/NoticeView.ascx
~/Areas/Notices/Views/Shared/NoticeView.aspx
~/Areas/Notices/Views/Shared/NoticeView.ascx
~/Views/NoticesSettings/NoticeView.aspx
~/Views/NoticesSettings/NoticeView.ascx
~/Views/Shared/NoticeView.aspx
~/Views/Shared/NoticeView.ascx
~/Areas/Notices/Views/NoticesSettings/NoticeView.aspx
~/Areas/Notices/Views/NoticesSettings/NoticeView.ascx
~/Areas/Notices/Views/Shared/NoticeView.aspx
~/Areas/Notices/Views/Shared/NoticeView.ascx
~/Views/InputBuilders/NoticeView.aspx 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Posted
Updated 18-Apr-12 17:14pm
v2
Comments
Dhanamanikandan 19-Apr-12 13:22pm
   
pls share your code

1 solution

Hi there,
This error occur usually when you don't set the start action.. To set the start action follow this:
In every application there is a Global.asax. Open that file and set the startup controller and action name.

C#
public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

        }

In this scenario I want to execute "Index" action of "Home" controller..

All the best
   
v2
Comments
cateyes99 26-Apr-12 22:03pm
   
Thanks very much. But our project has the same statements in RegisterRoutes() for the Default route, so doesn't seems because of this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900