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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:25:54+00:00 2026-05-28T05:25:54+00:00

i’ve created a basic mvc3 website whereby each controller represents the first folder in

  • 0

i’ve created a basic mvc3 website whereby each controller represents the first folder in a url structure.

for example, the “food” and “drinks” folders below are controller. there are only two controllers which contain all of the sub-items in them.

ie in the first line of the example, controller=food, method=asian

in the second line controller=food, method=pad-thai and so on and so forth.

http://www.mysite.com/food/asian/
http://www.mysite.com/food/asian/pad-thai
http://www.mysite.com/food/italian/chicken-parmigiana
http://www.mysite.com/drinks/cocktails/bloody-mary

how would i write routes so that http://www.mysite.com/food/asian/pad-thai will direct to the food controller and the paid thai method within that controller, and also have a rule to send from http://www.mysite.com/food/asian/ to the food controller and asian index method??

  • 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-28T05:25:55+00:00Added an answer on May 28, 2026 at 5:25 am

    The MVC design pattern isn’t for rewriting URLs to point to folder structures. It can do this but it certainly isn’t its main purpose. If you’re trying to create a URL structure with static content, it might be easier to use the URL rewriting functionality built into IIS.

    If you’re creating a full MVC application, set up FoodController and DrinkController to serve up your views, for example:

    public class FoodController : Controller
    {
      public ActionResult ViewDishByTag(string itemType, string itemTag)
      {
    
        // If an itemType is displayed without itemTag, return an 'index' list of possible dishes...
    
        // Alternatively, either return a "static" view of your page, e.g.
        if (itemTag== "pad-thai") 
             return View("PadThai"); // where PadThai is a view in your shared views folder
    
         // Alternatively, look up the dish information in a database and bind return it to the view
         return ("RecipeView", myRepo.GetDishByTag(itemTag));
      }
    }
    

    Using the example above, your route might look a little like this:

    routes.MapRoute(
                    "myRoute",
                    "{controller}/{itemType}/{itemTag}",
                    new
                    {
                        controller = UrlParameter.Required,
                        action = "ViewDishByTag",
                        itemtype = UrlParameter.Optional,
                        itemTag = UrlParameter.Optional
                    }
                );
    

    Your question doesn’t contain much detail about your implementation, so if you’d like me to expand on anything, please update your question.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
i got an object with contents of html markup in it, for example: string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.