AMDI
AMDI

Reputation: 973

View is not rendering correctly in ASP.NET MVC 3

I have moved a view from folder to Shared folder. When I try to navigate from controller to the shared view it is navigating to the default view and not the shared view. I checked in Global.asax, I created new route in the Global.asax, but it is still pointing to the default route and loading the default view.

Could anyone help me in resolving this issue?

Upvotes: 0

Views: 97

Answers (2)

Rafay
Rafay

Reputation: 31033

if you have not explicitly defined the name of the view e.g lets suppose you have an ActionResult in Home controller

public ActionResult Index()
{
return View();
}

the view by the name of Index.aspx and/or Index.ascx is searched first in the Home folder which is present in the Views folder if a matching veiw is found there it is not searched further. If it is not found then it will be searched in the Shared folder

make sure you have deleted the view form the Default location

Upvotes: 1

Paul McCaskie
Paul McCaskie

Reputation: 477

Make sure the old view is deleted, otherwise it will always pick that one over the shared folder.

Upvotes: 3

Related Questions