Use the URL mapping of ASP.NET 2.0

xiaoxiao2021-03-06  97

Introduction: URL mapping is the new feature provided in ASP.NET 2.0. URL mapping technology helps us map a particular URL to another URL. To help understand, we assume that you have a page called HomePage.aspx on the site to access the home page, all users have also used this page to access your homepage. But for some reason, you have to change the homepage to OriginalHome.aspx. Use the URL mapping at this time allows you to map to a new page without notifying the user. If we set up a URL mapping, then any user enters homepage.aspx in the URL bar, the call is ORIGINALHOME.ASPX. In-depth concept: Let us see how to implement it. This can be implemented in the Configuration section. Syntax: If you want to use the URL mapping, you must set the enabled property to True. Each add element contains an original URL and a mapping URL. Yes, the concept is simple! If we configure the URL map for the above scene, the elements in the config file are displayed as follows: Once we have modified or in the project's web.config file, any user attempts to access HomePage.aspx, because the URL mapping is called, the originAlHome.aspx page will be called. Interesting is that only HOMEPAGE.ASPX is still displayed in the URL column. So, although it is thought that the internal call / execute OriginalHome.aspx, users still see HopePage.aspx in the URL bar. Some advantages: 1. If your client is marked to a page link, you have to delete this page and replace other pages, then use the URL mapping you can solve this business problem without letting customers know this page change. 2. If there is a big and complicated URL, but don't want to give it to the user, then you can inform the simple URL, and you will map your simple URL to the original URL. 3. Use this method to make it easy to handle the menu control. The best example is the ASP.NET site. 4. This is also involved here (users cannot see the real page name in the URL column, which is also an encryption!). I hope you like this new feature. Yes, I know, now your question is, since ASP.NET 2.0 is still not available, how to take advantage of this new feature. There is a workaround here. Stev explained a brief explanation in his blog. You can

Http://weblogs.asp.net/ssmith/archive/2003/11/06/36191.aspx

see. His explanation is very simple, according to your actual case, you can add functions for it. Now you can use this trick, and wait for the ASP.NET 2.0, you can use new features.