0

i have a page with ~/x.aspx with urlmappings :

<add url="Home" mappedUrl="~/x.aspx" />

what i want is when calling ~/x.aspx?type=y then url still display Home is there any way to do that

<add url="Home" mappedUrl="~/x.aspx" />
 <add url="Home" mappedUrl="~/x.aspx?type=y" />
Hanaa Gebril
  • 187
  • 1
  • 13

2 Answers2

0

If you're using Web Forms, you can use the following tutorial. Basically the "type" could be a list of optional check boxes and the complete URL with parameters could be constructed in your code-behind.

Walkthrough: Using ASP.NET Routing in a Web Forms Application

For MVC, see the following question:

Routing with Multiple Parameters using ASP.NET MVC

Community
  • 1
  • 1
IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
0

I haven't work with mappings in the web.config but apparently is not possibly to use wildcards/regex

But you can do that by overwriting in your Global.asax the method Application_Start

   protected void Application_Start(object sender, EventArgs e)
    {
        RouteConfig.RegisterRoutes(RouteTable.Routes);
    }

RouteConfig.cs

public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            // routing segment variable: {}
            routes.MapPageRoute(null, "home", "~/Pages/x.aspx");
            routes.MapPageRoute(null, "home/{type}", "~/Pages/x.aspx");
Ed_
  • 973
  • 11
  • 25