Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 3: The Navigation Framework > Enabling Friendly URIs with URI Mapping

Enabling Friendly URIs with URI Mapping

As discussed earlier in this chapter, it's possible to set up a mapping scheme to automatically transform the URI that has been navigated to (visible to the user in the browser's address bar) into a form that the navigation framework can act on, which typically contains the path to the view to navigate to and any query string parameters to pass to it. For example, the mapping could transform the following URI

ProductDetails/879

to its actual representation internally:

/Views/ProductDetailsView.xaml?ProductID=879

The feature of the navigation framework that makes this automatic transformation possible is the URI mapper, which is assigned to the Frame control's UriMapper property. When a navigation operation takes place in your application, the Frame control will first parse and transform the given deep link via its URI mapper. It will then use this result to determine what view to load and the query string to pass to it. You will be familiar with the concept of URI mapping if you've worked on an ASP.NET MVC project before, as this mapping is quite similar to the URL routing functionality available there—although in this case we are rewriting only the deep link—not the entire URL, as with ASP.NET MVC URL routing.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial