Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the bi-directional Routing support in ASP.NET Web Forms 4.0?

Shulou Source: shulou.com Published: 2022-06-02 22:35:07 10月04日 Update

This article shows you what two-way Routing support is in ASP.NET Web Forms 4.0. it is concise and easy to understand, and it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Channel 9 has just released a new 10-4 video showing how to use this new feature in ASP.NET 4.0.

Here is a piece of code shown in the video. They used a classic example to show how to map Product.aspx?category=Jerseys to Product/Jerseys. When using the ASP.NET Routing engine, we can add this mapping to RouteTable in Application_Start:

RouteTable.Routes.Add ("Product", new Route ("Product/ {name}", new PageRouteHandler ("~ / Product.aspx")

At present, in order to get bi-directional Routing support, users must rewrite Query String URL. However, when using ASP.NET 4.0, users can register the following expression constructor (expression builder):

* the expression is used to generate the URL and the second expression is used to get the route value. You can use the $symbol in the aspx page to access the expression:

If you want to get the value in the name property, you can use the Route object instead of the Request object:

RouteData.Values ["name"]

Or use the expression constructor:

Users can use the ASP.NET Routing engine and new bidirectional support to decouple URL from physical Web Form to support URL, which is more search engine friendly.

The above is what two-way Routing support is like in ASP.NET Web Forms 4.0. have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Support two-way users expressions engines content objects skills knowledge video constructors concise concise code that is attributes search engines articles new features more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL Microsoft Apple OPPO Reno