---
title: "ASP MVC3 - ActionLink not routing to controller properly"  
description: "ASP MVC3 - ActionLink not routing to controller properly"  
author: "Samuel Fernandes"  
published: 2013-04-05  
updated: 2013-04-05  
canonical: https://www.mindstick.com/forum/712/asp-mvc3-actionlink-not-routing-to-controller-properly  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 2 minutes  

---

# ASP MVC3 - ActionLink not routing to controller properly

Hi Everyone!\
Below is the action link I'm using in an ASP MVC3 view. I need to a method in the controller and send in [two variables](https://www.mindstick.com/forum/236/how-can-i-swap-two-variables-without-using-a-third-variable). These variables serve as the \
compound key on a [SQL table](https://www.mindstick.com/forum/160519/how-can-i-update-sql-table-by-dataset-data-in-ado-dot-net) that the [controller method](https://www.mindstick.com/forum/157312/how-to-call-a-controller-method-after-load-view-successfully-in-mvc-4) is trying to pull information from.\
The link appears to be rendered properly by the @[Html.ActionLink](https://www.mindstick.com/forum/157896/what-is-the-difference-between-the-html-actionlink-and-ajax-actionlink-helpers-in-asp-dot-net-mvc), however I [am getting](https://www.mindstick.com/forum/34179/i-am-getting-error-while-assigning-the-data-to-the-array-list) this error:\
Description: HTTP 404. The [resource](https://www.mindstick.com/blog/43433/top-best-resources-for-women-about-beauty-and-health) you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily \
unavailable. Please review the following URL and make sure that it is spelled correctly.\
Requested URL: /BankListMasterController/AgentEdit/11\
Here is the action link\
@Html.ActionLink("Edit Agent", "AgentEdit", "BankListMasterController", new { agentId = int.Parse(item.AgentId), id = item.ID }, null)Here is the controller method\
public [ViewResult](https://www.mindstick.com/forum/33961/what-is-the-difference-between-actionresult-and-viewresult) AgentEdit(int id, int agentId) { string compare = agentId.ToString();\
BankListAgentId agent = (from c in db.BankListAgentId where c.ID == id && c.AgentId.Equals(compare) select c).Single();\
return View("AgentEdit", agent); }and here is the URL that is rendered in the original view\
http://localhost:2574/BankListMasterController/AgentEdit/11?agentId=5309721I've also put a breakpoint in the first line of the method and it never gets tripped when debugging.\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)! \

## Replies

### Reply by AVADHESH PATEL

Hi Samuel!\
You can try this way\
include "[controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc)" name in the third parameter.\

```
@Html.ActionLink("Edit Agent", "AgentEdit", "BankListMaster", new { agentId = int.Parse(item.AgentId), id = item.ID }, null)
```


---

Original Source: https://www.mindstick.com/forum/712/asp-mvc3-actionlink-not-routing-to-controller-properly

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
