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 6889087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:06:41+00:00 2026-05-27T06:06:41+00:00

I would like to display the view in the folder if no controller/action matches.

  • 0

I would like to display the view in the folder if no controller/action matches.

For example http://www.site.com/Home/Index, if I have the normal default route {controller}/{action}/{id} then I need a HomeController with method Index.
And there is a folder in Views folder called Home and the file Index.cshtml

If i try http://www.site.com/About/Index i need to create the AboutController and the method index.
But I have just the folder About and file Index.cshtml.

I would like that if the default route does not match but I have a Folder and a File in the Views folder that match the patern: {controller} is the folder {action} is the view; then that view is displayed.

How could I achive that?

  • 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-05-27T06:06:42+00:00Added an answer on May 27, 2026 at 6:06 am

    For missing actions you can override HandleUnknownAction.

    For missing controllers you can implement a custom DefaultControllerFactory and override GetControllerInstance with something like this:

    protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) {
    
       if (controllerType == null)
          return new DumbController();
    
       return base.GetControllerInstance(requestContext, controllerType);
    }
    
    class DumbController : Controller {
    
       protected override void HandleUnknownAction(string actionName) {
    
          try {
             View(actionName).ExecuteResult(this.ControllerContext);
          } catch (Exception ex) {
             throw new HttpException(404, "Not Found", ex);
          }
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIView(first view) on top of which I would like to display
In SCSF application I would like to display a view as a modal window
I would like to display a svg file inside a eclipse view. a) It
I would like to know if I can display a view inside another view
I would like to display a different view than the standard keyboard (a picker
I would like to display Brand and Subbrand together on a view page. I
We are using Plone 4.1, and would like to have a custom view of
I would like to know how can I display a view for about 3-4
I would like to display the same toolbar items in every view of my
I would like to display a Drupal view without the page template that normally

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.