The most straightforward way to add the Navigation framework to a new or existing ASP.NET Web Site or Application is to install it using NuGet by running the command Install-Package Navigation from within the Package Manager Console.
If NuGet is unavailable (prior to VS 2010) the set up can be performed manually. The first stage of this manual set up is to add a reference to the Navigation.dll, which can be downloaded from http://navigation.codeplex.com/
. After (unblocking and) unzipping the download the Navigation.dll should be obtained from the folder (beneath the bin folder) that corresponds to the version of .NET in use.
The next stage requires the registration of the StateAdapter class as an adapter for the Page control. The steps to follow are:
- Add an App_Browsers folder – right click the Web Project and select Add ASP.NET Folder -> App_Browsers
- Add a .browser file to the App_Browsers folder – right click the App_Browsers folder and select Add New Item, select Browser File and give it a name
- Configure the StateAdapter class as the Page’s control adapter – paste the configuration below into the .browser file
<adapter controlType="System.Web.UI.Page" adapterType="Navigation.StateAdapter, Navigation" />
The final stage of the manual set up is to create a StateInfo.config file, which will be used in the next section to hold the details of the pages and navigation between these pages:
- Add a new Text File called StateInfo.config file to the Web Project
- Point the Navigation framework at this file by adding the configuration below into the Web.config file
<section name="StateInfo" type="Navigation.StateInfoSectionHandler, Navigation"/>
<!-- other config elided -->
There is a small difference between the NuGet and manual installations which will be covered in the Navigation Hyperlink and Data Expression
Sample Web Site
Create a new Web Application project called NavigationSample, by selecting File -> New -> Project
and the ASP.NET Empty Web Application
option. Set it up to start using the Navigation framework by running the command Install-Package Navigation
from within the Package Manager Console.