---
title: "How to maproute and querystings in mvc?"  
description: "How to maproute and querystings in mvc?"  
author: "Manoj Bhatt"  
published: 2014-10-30  
updated: 2014-10-30  
canonical: https://www.mindstick.com/forum/2465/how-to-maproute-and-querystings-in-mvc  
category: "asp.net mvc"  
tags: ["asp.net mvc", "mvc4"]  
reading_time: 1 minute  

---

# How to maproute and querystings in mvc?

I have two routes:

```
routes.MapRoute(            "FetchVenue",                                                 "venue/fetchlike/{q}",                                                 new { controller = "venue", action = "fetchlike" }             );        routes.MapRoute(            "venue",                                                     "venue/{venueId}",                                             new { controller = "Venue", action = "Index" }           );
```

The [url](https://www.mindstick.com/forum/436/url-redirection) /[venue](https://answers.mindstick.com/qa/94470/is-venue-a-failure)/fetchlike/[test](https://yourviews.mindstick.com/story/1427/explosive-facts-about-trinity-test-world-s-first-nuclear-bomb) is passed to the correct [controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) The url /venue/fetchlike/?q=test is however passed to the [index](https://www.mindstick.com/blog/198/index-in-sql-server) [action](https://www.mindstick.com/forum/155752/what-is-action-result-with-its-types).

I want to be able to [pass data](https://www.mindstick.com/forum/351/how-to-pass-data-from-controller-to-ascx-page) as a querystring.

## Replies

### Reply by Anonymous User

Actually the issue was that the route:

```
routes.MapRoute( "FetchVenue", "venue/fetchlike/{q}",  new { controller = "venue", action = "fetchlike" });
```

should actually have been:

```
routes.MapRoute( "FetchVenue", "venue/fetchlike",  new { controller = "venue", action = "fetchlike" });
```

Meaning that the url would have been:

/venue/fetchlike?q=test

as suggested above by strelokstrelok.

So, in the case of querysting parameters, you DONT define them in the route!


---

Original Source: https://www.mindstick.com/forum/2465/how-to-maproute-and-querystings-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
