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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:12:26+00:00 2026-05-12T14:12:26+00:00

Consider an ASP.NET MVC 1.0 project using the Areas convention as described on this

  • 0

Consider an ASP.NET MVC 1.0 project using the Areas convention as described on this Nov. 2008 Phil Haack blog post. This solution works great once it’s set up!

My trouble is starting thanks to my limited knowledge of ASP.NET MVC’s routing rules.

My intention is to create an action method and URL structure like this:

http://mysite/Animals/Dogs/ViewDog/Buster

DogsController.ViewDog() looks like this:

public ActionResult ViewDog(string dogName)
{
     if (dogName!= null)
     {
         var someDog = new DogFormViewModel(dogName); //snip a bunch more

         return View(someDog);
     }
     else { return View("DogNotFound"); }           
}

The task at hand is ensuring that the RegisterRoutes() has the correct entries.

UPDATE

Here’s the new route being mapped:

routes.MapRoute("ViewDog", "Animals/{controller}/{action}/{dogName}",
                                     new { controller = "Dogs", 
                                           action = "ViewDog", dogName = "" });

The link to the URL is created:

<%= Html.RouteLink("Brown Buster", "ViewDog", new RouteValueDictionary(new { controller="Dogs", action="ViewDog", dogName="Buster" }))%>

The URL is created as expected. Thanks to Craig Stuntz and his blog post on Html.RouteLink.

http://mySite/Animals/Dogs/ViewDog/Buster

New Problem: The param dogName doesn’t pickup the string value “Buster” from the URL. The call to the method succeeds, but the argument evaluates to null.

Questions

How can you:

  • make this route work with a string, and remove the default convention int id in the route? I’d like to change the name of the parameter away from int.
  • 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-12T14:12:26+00:00Added an answer on May 12, 2026 at 2:12 pm

    Are you sure that ActionLink is actually matching the route you show them the question? When you have more than one route, I strongly recommend using RouteLink instead of ActionLink, as I explain in great detail in this post. When you use RouteLink, there is no possibility that you will match the wrong route, at least in URL generation.

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

Sidebar

Related Questions

Consider the scenario of upgrading an ASP.NET MVC project. This question is around up-converting
Consider an ASP.NET MVC application using the Salt parameter in the [ValidateAntiForgeryToken] directive. The
Consider an ASP.NET MVC 2 project with VS 2010. The goal is to set
Lets consider default ASP.NET MVC application folder structure, so it's looks like this: -App_data
Why would you consider using ASP.Net MVC or standard ASP.Net with forms and controls
Consider an ASP.NET MVC application that requires a session variable be set. It's used
I've been puzzled by what I consider a contradiction in terms: ASP.NET MVC claims
using ASP.NET MVC 2 I have a navigation menu inside my Master Page. In
So I have a VS 2010 solution containing one ASP.NET MVC 3 project and
Consider an ASP.NET MVC controller method that builds an ASP.NET Chart image. public FileStreamResult

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.