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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:14:43+00:00 2026-06-09T00:14:43+00:00

I have been trying to learn ASP.NET MVC 3 and things are going well

  • 0

I have been trying to learn ASP.NET MVC 3 and things are going well apart from the routing aspect, whatever I try I just can’t seem to get them quite right.

I have an ActionLink on the main page:

@Html.ActionLink("Contracts", "List", "Contract", 
                 new { User.Identity.Name, page=1 })

Which is meant to access this method in the ContractController:

public ViewResult List(string user, int page = 1)
{
    //snip
}

My routes are:

 routes.MapRoute(
     null, 
     "Page{page}",
     new { Controller = "Contract", action = "List" }
 );

 routes.MapRoute(
     null,
     "Page{page}",
     new { Controller = "Contract", action = "List", user = "", page = 1 }
 );

 routes.MapRoute(
     "Default", // Route name
     "{controller}/{action}/{id}", // URL with parameters
     new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
 );

The link now will return a 404 error as it can’t find the action ‘List’ in the controller ‘Home’, which obviously means it didn’t use either of the first routes.

Everything worked before I tried to add parameters to the ActionLink, so basically, what am I doing wrong?

Thanks very much.

  • 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-09T00:14:45+00:00Added an answer on June 9, 2026 at 12:14 am

    Alex,

    You’re doing all the other bits absolutely correctly, however the actionlink has a missing parameter, try this for your actionlink:

    @Html.ActionLink("Contracts", "List", "Contract", 
                 new { User.Identity.Name, page = 1 }, null)
    

    Adding the null as the final param (htmlAttributes) is all that’s missing for you in this scenario (there are 9 overloads for Html.ActionLink, so it’s VERY easy to miss the correct implementation).

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

Sidebar

Related Questions

Actually I am trying to learn jQuery Ajax calls to asp.Net webservices. I have
I am trying to learn Asp.net Mvc so I am trying out this Tutorial.
I am just trying to learn how to use JQuery AJAX with ASP.NET MVC
I'm trying to learn a bit of ASP.net MVC 3 and I'm facing a
I have been trying to learn from reading tutorials online and stuff but I
Im new to ASP.NET MVC, trying to learn the basics. Im now trying to
I have been trying to learn how to build jQuery plugins, so I'm still
I have been trying to learn python over the last couple of months and
I have been trying to learn Erlang and have been running into some problems
I have been trying to learn a cross platform language with a fast learning

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.