---
title: "How to Map URL with controller"  
description: "How to Map URL with controller"  
author: "Anupam Mishra"  
published: 2016-02-03  
updated: 2016-02-03  
canonical: https://www.mindstick.com/forum/33952/how-to-map-url-with-controller  
category: "asp.net"  
tags: ["c#", "asp.net", "asp.net mvc"]  
reading_time: 1 minute  

---

# How to Map URL with controller

Hi Everyone,I want that when we types “http://localhost/View/View [Student](https://www.mindstick.com/articles/157138/student-loan-default-wage-garnishment-and-student-loan)/”, it goes to the “Student” [Controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) and invokes the DisplayStudent [action](https://www.mindstick.com/forum/155752/what-is-action-result-with-its-types). Please give me solution, how to [map](https://yourviews.mindstick.com/view/81351/nepal-parliament-s-approves-new-controversial-map-india-rejects-it-but) this action with controller,when we types a such type url.\
Thank you.

## Replies

### Reply by Anupam Mishra

For solving above problem, we have adding an entry in to the routes collection using the **maproute** function. In Below i have underlined code which shows how the URL structure and mapping with controller and action is defined.\

```
routes.MapRoute(               "View", // Route name               "View/ViewStudent/{id}", // URL with parameters               new { controller = "Student", action = "DisplayStudent", id = UrlParameter.Optional });
```

\


---

Original Source: https://www.mindstick.com/forum/33952/how-to-map-url-with-controller

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
