Web developers must be very familiar with the hyperlink control. The code generated on the client is a tag. The hyperlink control in aspnet4 has made some improvements compared with previous versions, so it can better support URL rewriting, the following is an example of improving URL rewriting in net4.0 --- ASPnet to explain the new hyperlink function.
1. Add a hyperlink control to the default. aspx page of the Project, right-click the control in the design view, select properties, and select expresstions in the Properties window, for example:
2. Click the three dots on the right. In the pop-up dialog box, set as follows:
Set routename to productdetail to direct the link to the test. ASPX page, because test. aspx is used to set the physical file of the Route named productdetail in global. asax. Routevalus is the configuration parameter. The category and name here are also configured in global. asax.
3. Click OK and switch to the Code view. The Code is as follows:
<Asp: hyperlink id = "hyperlink1" runat = "server" navigateurl = "<% $ routeurl: routename = productdetail, Category = computer, name = ThinkPad %> "> test page </ASP: hyperlink>
4. Set default. aspx as the start page and press F5 to run. Click the test page Link to go to the test. ASPX page, for example: