---
title: "ASP.NET 4.0 Url Routing"  
description: "ASP.NET 4.0 Url Routing"  
author: "Anonymous User"  
published: 2014-12-03  
updated: 2014-12-04  
canonical: https://www.mindstick.com/forum/12740/asp-dot-net-4-0-url-routing  
category: "asp.net"  
tags: ["c#", "url routing"]  
reading_time: 1 minute  

---

# ASP.NET 4.0 Url Routing

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to use Rounting in [ASP.NET](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) 4.0

**This is my [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):([global.asax](https://www.mindstick.com/interview/1833/what-are-the-event-handlers-that-can-be-included-in-the-global-asax-file) file)**

```
    void Application_Start(object sender, EventArgs e)     {        RegisterRoutes(System.Web.Routing.RouteTable.Routes);    }     void RegisterRoutes(System.Web.Routing.RouteCollection routes)    {         routes.MapPageRoute("recordingDemo", "recording.aspx", "~/About.aspx?sub=recordingdemo");    }
```

## In About.aspx:

```
 if (Request.QueryString["sub"] != null) {      switch (Request.QueryString["sub"].ToString())      {                    case "demo":                        multiviewRecording.SetActiveView(viewDemo);                        break;      }      ..........}
```

The [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is that I don't have anymore [querystring](https://www.mindstick.com/interview/123/what-is-querystring-benefits-and-limitations-of-using-querystring) in About [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page).

What I want to do is: on [link](https://www.mindstick.com/articles/23633/link-builder) recording.aspx(this page doesn't [exists](https://www.mindstick.com/forum/158947/how-do-you-use-the-exists-operator-to-check-for-the-existence-of-records-in-a-subquery) in my page) I want to open the page About.aspx?sub=recordingdemo

It is possible to do something like this with Url Rounting?

## Replies

### Reply by Anonymous User

I found out the solution:

routes.MapPageRoute("recordingDemo", "recording.aspx", "~/About.aspx?sub=recordingdemo",, true, new System.Web.Routing.RouteValueDictionary{{"sub", "demo"}});

And in About.aspx :

string route = Page.RouteData.Values["sub"].ToString();

I hope that my solution will help some other people.


---

Original Source: https://www.mindstick.com/forum/12740/asp-dot-net-4-0-url-routing

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
