Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8541663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:52:54+00:00 2026-06-11T11:52:54+00:00

I have ported an mvc 3 app from vs 2010 to vs2012. The ported

  • 0

I have ported an mvc 3 app from vs 2010 to vs2012.

The ported app is using .NET 4.

All the old bits work, but with a new view, created in vs 2012, the view engine is not looking for .cshtml files for the view.

For example, when the user requests the index action on the Welcome controller in the Solicitors area, the url is:

mysite.com/solicitors/welcome/gg 

(where gg is the user name). In that case, the error that comes back is:

The view ‘Index’ or its master was not found or no view engine
supports the searched locations. The following locations were
searched: ~/Areas/Solicitors/Views/Welcome/Index.aspx
~/Areas/Solicitors/Views/Welcome/Index.ascx
~/Areas/Solicitors/Views/Shared/Index.aspx
~/Areas/Solicitors/Views/Shared/Index.ascx ~/Views/Welcome/Index.aspx
~/Views/Welcome/Index.ascx ~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx ~/Areas/Solicitors/Views/Welcome/gg.master
~/Areas/Solicitors/Views/Shared/gg.master ~/Views/Welcome/gg.master
~/Views/Shared/gg.master ~/Areas/Solicitors/Views/Welcome/gg.cshtml
~/Areas/Solicitors/Views/Welcome/gg.vbhtml
~/Areas/Solicitors/Views/Shared/gg.cshtml
~/Areas/Solicitors/Views/Shared/gg.vbhtml ~/Views/Welcome/gg.cshtml
~/Views/Welcome/gg.vbhtml ~/Views/Shared/gg.cshtml
~/Views/Shared/gg.vbhtml

I have already added the following key to appsettings in web.config, but it makes no difference.

<add key="webpages:Version" value="1.0" />

EDIT:

Route in SolictorAreaRegistration.cs:

context.MapRoute(
                "Solicitors_Welcome",
                "Solicitors/Welcome/{nameUser}",
                new { controller = "Welcome", action = "Index", nameUser = UrlParameter.Optional }
            );

EDIT 2:

Using RouteDebug, I can see that the correct controller and action are found.

Route Data

Key Value

nameUser: gg

controller: Welcome

action: Index

Data Tokens

Key Value

Namespaces: System.String[]

area: Solicitors

UseNamespaceFallback: False

EDIT 3:

The route is found correctly, as I can see from debugging: the Index action is hit.

The problem happens when the line call the view is called:

namespace MyApp.Areas.Solicitors.Controllers
{
    [Authorize]
    public partial class WelcomeController : Controller
    {
        //
        // GET: /Solicitors/Welcome/
        public virtual ActionResult Index(string nameUser)
        {
            return View("Index", nameUser);
        } 
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:52:55+00:00Added an answer on June 11, 2026 at 11:52 am

    OK, got to the bottom of it:

    The Problem:

    The problem is that the model of my view is of type string. In my action, I was passing in a string as the model parameter:

    public virtual ActionResult Index(string nameUser)
            {
                return View("Index", nameUser);
            }
    

    This will clash with one of the overloads of Controller.View(…):

    View(string, string)
    

    The second parameter expects the name of a layout file. When you do this, MVC goes off looking for a layout file with a name of the value of your string, which could be, for example:

    “Hello, World. I’m an idiot, but if you give me a decent error message, I might be able to fix the bug.”

    Obviously, a layout file with that name doesn’t exist. Nor does a layout file called “gg” either (my (test) solicitor’s username).

    The Solution:

    The solution is simple:

    Specify that the second parameter is the model, not the layout.

    public virtual ActionResult Index(string nameUser)
            {
                return View("Index", model: nameUser);
            }
    

    Useful Article:

    To view an extended discussion of this very issue, see the following article:

    MVC Gotcha: Beware when using your view’s model is a string

    Many thanks to heartysoft.com for the enlightenment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC Form, but the data from it needs to be
I have just ported an HTML site over to ASP.NET MVC 3. Google appears
I am using the DataAnnotations for error checking on my asp.net mvc app, I
I found a great tutorial on creating an MVC App from Scratch using Sencha
I have an ASP.NET MVC 3 application and am using Ninject for injecting dependencies
Short Version : I'm using a 64bit dll (system.data.sqlite) in an Asp.net MVC app
I have a ASP.NET MVC 2 app I am building and users are allowed
I have ported a search from Coldfusion into a MySQL stored procedure. The actual
I have a project being ported to work on Linux under Mono. The project
I have an old C# program that is being ported to Python 3 for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.