Configure Route ASP.NET Webforms

Asked

Viewed 71 times

2

Good afternoon, I have an ASP.NET application in Webforms (still) working normally, the client asked to include the date in the route of a new page, I created the route so:

  routes.MapPageRoute(
         "RevendaMapRoute",
         "Revendas/{data}/{idnome}",
         "~/Revendas.aspx", false,null,
          new RouteValueDictionary { {"data", @"\d{2}/\d{2}/\d{4}"},{ "idnome", "[a-z0-9 -]*" } });´´´´

In Page_load . Cs I recover the URL like this:

            var rt = RouteData.Route as Route;
            if (rt != null && rt.Url == "Revendas/{data}/{idnome}")
            {}´´

The call to the route:

<a href='<%#: GetRouteUrl("RevendaMapRoute", new { data = Item.DATA, idnome = Item.NOME_REVENDA_ROUTE}) %>'><%#: Item.NOME_REVENDA %></a>´´

When I click on the link the return is 404 non-existent page... I believe that the normal '/' bar on the date is not identifying the route correctly, because as I said without the route date it works normally. Grateful for any help.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.