SlideShare uma empresa Scribd logo
1 de 14
•   Site Maps
•   Defining a Site Map
•   Site Map Rules
•   Binding a Page to Site Map
•   SiteMapPath Control
•   TreeView Control
•   Menu Control
•   URL Mapping and Routing
ASP.NET includes a navigation model that makes it easy to
let users surf through your web applications.

It consists of three components:

• A way to define the navigational structure of your website.
(XML SiteMap)

• A convenient way to read the information in the site map file
and convert it to an object model (SiteMapDataSource
control and the XmlSiteMapProvider)

• A way to use the site map information to display the user’s
current position and give the user the ability to easily move
from one place to another (Navigation Controls)
• The starting point in site map-based navigation is the
  XmlSiteMapProvider which retrieves site map information
  from an XML file.

• The XmlSiteMapProvider looks for a file named
  Web.sitemap in the root of the virtual directory.

• XmlSiteMapProvider extracts the site map data and create
  the corresponding SiteMap object.

• SiteMap object is then made available to the
  SiteMapDataSource, which you place on every page that
  uses navigation.

• The SiteMapDataSource provides the site map information
  to navigation controls, which are the final link in the chain.
Before you can fill in the content in your site map file,
you need to understand the rules that all ASP.NET site
maps must follow.

• Rule 1: Site Maps Begin with the <siteMap> Element
• Rule 2: Each Page Is Represented by a
  <siteMapNode> Element
• Rule 3: A <siteMapNode> Element Can Contain
  Other <siteMapNode> Elements
• Rule 4: Every Site Map Begins with a Single
  <siteMapNode>
• Rule 5: Duplicate URLs Are Not Allowed
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">

<siteMapNode title="Home" description="Home" url="~/default.aspx">

<siteMapNode title="Information" description="Learn about our company“>
     <siteMapNode title="About Us“ description="How RevoTech was
     founded“ url="~/aboutus.aspx" />
     <siteMapNode title="Investing“ description="Financial reports and
     investor analysis“ url="~/financial.aspx" />
</siteMapNode>

<siteMapNode title="Products" description="Learn about our products">
     <siteMapNode title="RevoStock“ description="Investment software for
     stock charting“ url="~/product1.aspx" />
     <siteMapNode title="RevoAnalyze“ description="Investment software for
     yield analysis“ url="~/product2.aspx" />
</siteMapNode>

</siteMapNode>
</siteMap>
You can create a site map using a text editor such as
Notepad, or you can create it in Visual Studio by
selecting Website ➤ Add New Item and then choosing
the Site Map option.

Once you’ve defined the Web.sitemap file, you’re ready
to use it in a page the next step is to add the
SiteMapDataSource control to your page.

The last step is to add controls that are linked to the
SiteMapDataSource. These are the three navigation
controls:
• TreeView
• Menu
• SiteMapPath
Website navigation works best when combined with
another ASP.NET feature—master pages.

That’s because you’ll usually want to show the same
navigation controls on every page.

The easiest way to do this is to create a master page
that includes the SiteMapDataSource and the navigation
controls.

You can then reuse this template for every other page on
your site.
The SiteMapPath provides breadcrumb navigation,
which means it shows the user’s current location and
allows the user to navigate up the hierarchy to a higher
level using links.
By breaking a single site map into separate files using the
siteMapFile attribute, like this:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >

<siteMapNode title="Root" description="Root" url="~/default.aspx">
<siteMapNode siteMapFile="Dealers.sitemap" />
<siteMapNode siteMapFile="Employees.sitemap" />
</siteMapNode>

</siteMap>
The site map model is designed around a simple
principle: each entry has a separate URL.
Although you can distinguish URLs by adding
query string arguments, in many websites there is
one-to-one correspondence between web forms
and site map entries.

ASP.NET has two tools that may be able to help
you:

• URL Mapping
• URL Routing
In some situations, you might want to have several URLs lead to
the same page. This might be the case for a number of
reasons—maybe you want to implement your logic in one page
and use query string arguments but still provide shorter and
easier-to-remember URLs to your website users.
You define URL mapping in the <urlMappings> section of the
web.config file. You supply two pieces of information—the
request URL (as the url attribute) and the new destination URL
(mappedUrl).
<configuration>
<system.web>
<urlMappings enabled="true">
<add url="~/category.aspx"
mappedUrl="~/default.aspx?category=default" />
<add url="~/software.aspx"
mappedUrl="~/default.aspx?category=software" />
</urlMappings>
...
</system.web>
</configuration>
Unlike URL mapping, URL routing doesn’t take place
in the web.config file. Instead, it’s implemented using
code. Typically, you’ll use the Application_Start()
method in the global.asax file to register all the routes
for your application.

To register a route, you use the RouteTable class from
the System.Web.Routing namespace. It provides a
static property named Routes, which holds a
collection of Route objects that are defined for
your application. Initially, this collection is empty, but
you can your custom routes by calling the
MapPageRoute() method, which takes three
arguments: routeName, routeUrl, physicalFile
protected void Application_Start(object sender, EventArgs e)
{

RouteTable.Routes.MapPageRoute("product-details",
"product/{productID}", "~/productInfo.aspx");
RouteTable.Routes.MapPageRoute("products-in-category",
"products/category/{categoryID}", "~/products.aspx");

}

Here’s a URL that uses this route to request a product with the
ID FI_00345:
http://localhost:[PortNumber]/Routing/product/FI_00345

Mais conteúdo relacionado

Mais procurados

Introduction to Foxx by our community member Iskandar Soesman @ikandars
Introduction to Foxx by our community member Iskandar Soesman @ikandarsIntroduction to Foxx by our community member Iskandar Soesman @ikandars
Introduction to Foxx by our community member Iskandar Soesman @ikandarsArangoDB Database
 
iPhone Web Development and Ruby On Rails
iPhone Web Development and Ruby On RailsiPhone Web Development and Ruby On Rails
iPhone Web Development and Ruby On RailsJose de Leon
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentationengcs2008
 
Building SharePoint Single Page Applications Using AngularJS
Building SharePoint Single Page Applications Using AngularJSBuilding SharePoint Single Page Applications Using AngularJS
Building SharePoint Single Page Applications Using AngularJSSharePointInstitute
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applicationsdominion
 
Tech talk live share extras extension modules feb 13
Tech talk live   share extras extension modules feb 13Tech talk live   share extras extension modules feb 13
Tech talk live share extras extension modules feb 13Alfresco Software
 
Migration to SharePoint 2013 – Theory and practice
Migration to SharePoint 2013 – Theory and practiceMigration to SharePoint 2013 – Theory and practice
Migration to SharePoint 2013 – Theory and practiceSPC Adriatics
 
Tech talk-live-alfresco-drupal
Tech talk-live-alfresco-drupalTech talk-live-alfresco-drupal
Tech talk-live-alfresco-drupalAlfresco Software
 
Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Derek Gusoff
 
SharePoint 2010 Content Query Web Part
SharePoint 2010 Content Query Web PartSharePoint 2010 Content Query Web Part
SharePoint 2010 Content Query Web PartKim Frehe
 
Why Drupal?
Why Drupal?Why Drupal?
Why Drupal?Grossum
 
Skillwise - Advanced web application development
Skillwise - Advanced web application developmentSkillwise - Advanced web application development
Skillwise - Advanced web application developmentSkillwise Group
 
.Net Distributed Caching
.Net Distributed Caching.Net Distributed Caching
.Net Distributed CachingPaul Fryer
 

Mais procurados (20)

Lecture11
Lecture11Lecture11
Lecture11
 
Introduction to Foxx by our community member Iskandar Soesman @ikandars
Introduction to Foxx by our community member Iskandar Soesman @ikandarsIntroduction to Foxx by our community member Iskandar Soesman @ikandars
Introduction to Foxx by our community member Iskandar Soesman @ikandars
 
iPhone Web Development and Ruby On Rails
iPhone Web Development and Ruby On RailsiPhone Web Development and Ruby On Rails
iPhone Web Development and Ruby On Rails
 
Ajax
AjaxAjax
Ajax
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Building SharePoint Single Page Applications Using AngularJS
Building SharePoint Single Page Applications Using AngularJSBuilding SharePoint Single Page Applications Using AngularJS
Building SharePoint Single Page Applications Using AngularJS
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
 
Hawaii Pacific GIS Conference 2012: Real-Time Data Acquisitions - Bringing In...
Hawaii Pacific GIS Conference 2012: Real-Time Data Acquisitions - Bringing In...Hawaii Pacific GIS Conference 2012: Real-Time Data Acquisitions - Bringing In...
Hawaii Pacific GIS Conference 2012: Real-Time Data Acquisitions - Bringing In...
 
Tech talk live share extras extension modules feb 13
Tech talk live   share extras extension modules feb 13Tech talk live   share extras extension modules feb 13
Tech talk live share extras extension modules feb 13
 
Migration to SharePoint 2013 – Theory and practice
Migration to SharePoint 2013 – Theory and practiceMigration to SharePoint 2013 – Theory and practice
Migration to SharePoint 2013 – Theory and practice
 
JSP Part 2
JSP Part 2JSP Part 2
JSP Part 2
 
Tech talk-live-alfresco-drupal
Tech talk-live-alfresco-drupalTech talk-live-alfresco-drupal
Tech talk-live-alfresco-drupal
 
Advanced sass
Advanced sassAdvanced sass
Advanced sass
 
Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2
 
Linking webinar
Linking webinarLinking webinar
Linking webinar
 
SharePoint 2010 Content Query Web Part
SharePoint 2010 Content Query Web PartSharePoint 2010 Content Query Web Part
SharePoint 2010 Content Query Web Part
 
Why Drupal?
Why Drupal?Why Drupal?
Why Drupal?
 
Skillwise - Advanced web application development
Skillwise - Advanced web application developmentSkillwise - Advanced web application development
Skillwise - Advanced web application development
 
.Net Distributed Caching
.Net Distributed Caching.Net Distributed Caching
.Net Distributed Caching
 
Apache Gobblin
Apache GobblinApache Gobblin
Apache Gobblin
 

Destaque (6)

07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10
 
Chapter 16
Chapter 16Chapter 16
Chapter 16
 
Chapter 25
Chapter 25Chapter 25
Chapter 25
 
Chapter 23
Chapter 23Chapter 23
Chapter 23
 
Chapter 26
Chapter 26Chapter 26
Chapter 26
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
 

Semelhante a Chapter 13

ASP.NET 07 - Site Navigation
ASP.NET 07 - Site NavigationASP.NET 07 - Site Navigation
ASP.NET 07 - Site NavigationRandy Connolly
 
Search engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATGSearch engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATGVignesh sitaraman
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8Thomas Robbins
 
State management 1
State management 1State management 1
State management 1singhadarsh
 
Sitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsSitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsnonlinear creations
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!Fioriela Bego
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!Commit Software Sh.p.k.
 
Hdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed SolutionsHdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed Solutionswoutervugt
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introductionTomi Juhola
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handsonPrashant Kumar
 
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...SPTechCon
 
Tips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC ApplicationsTips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC ApplicationsSarvesh Kushwaha
 
Java-Web-Applications.pdf
Java-Web-Applications.pdfJava-Web-Applications.pdf
Java-Web-Applications.pdfssuserf2dc4c1
 
Oracle APEX URLs Untangled & SEOptimized
Oracle APEX URLs Untangled & SEOptimizedOracle APEX URLs Untangled & SEOptimized
Oracle APEX URLs Untangled & SEOptimizedChristian Rokitta
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVCSagar Kamate
 
Advance java session 13
Advance java session 13Advance java session 13
Advance java session 13Smita B Kumar
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service BIOVIA
 

Semelhante a Chapter 13 (20)

ASP.NET 07 - Site Navigation
ASP.NET 07 - Site NavigationASP.NET 07 - Site Navigation
ASP.NET 07 - Site Navigation
 
Search engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATGSearch engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATG
 
Ch05 state management
Ch05 state managementCh05 state management
Ch05 state management
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
Ajax
AjaxAjax
Ajax
 
State management 1
State management 1State management 1
State management 1
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
Sitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsSitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayouts
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
 
Hdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed SolutionsHdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed Solutions
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
Tips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC ApplicationsTips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC Applications
 
Java-Web-Applications.pdf
Java-Web-Applications.pdfJava-Web-Applications.pdf
Java-Web-Applications.pdf
 
Oracle APEX URLs Untangled & SEOptimized
Oracle APEX URLs Untangled & SEOptimizedOracle APEX URLs Untangled & SEOptimized
Oracle APEX URLs Untangled & SEOptimized
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
 
Advance java session 13
Advance java session 13Advance java session 13
Advance java session 13
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service
 

Mais de application developer (20)

Assignment
AssignmentAssignment
Assignment
 
Next step job board (Assignment)
Next step job board (Assignment)Next step job board (Assignment)
Next step job board (Assignment)
 
Chapter 19
Chapter 19Chapter 19
Chapter 19
 
Chapter 18
Chapter 18Chapter 18
Chapter 18
 
Chapter 17
Chapter 17Chapter 17
Chapter 17
 
Week 3 assignment
Week 3 assignmentWeek 3 assignment
Week 3 assignment
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
C # test paper
C # test paperC # test paper
C # test paper
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Chapter 8 part2
Chapter 8   part2Chapter 8   part2
Chapter 8 part2
 
Chapter 8 part1
Chapter 8   part1Chapter 8   part1
Chapter 8 part1
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Week 1 Assignment Q2 Solution
Week 1 Assignment Q2 SolutionWeek 1 Assignment Q2 Solution
Week 1 Assignment Q2 Solution
 
Week 1 assignment q2
Week 1 assignment q2Week 1 assignment q2
Week 1 assignment q2
 

Último

MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

Chapter 13

  • 1. Site Maps • Defining a Site Map • Site Map Rules • Binding a Page to Site Map • SiteMapPath Control • TreeView Control • Menu Control • URL Mapping and Routing
  • 2. ASP.NET includes a navigation model that makes it easy to let users surf through your web applications. It consists of three components: • A way to define the navigational structure of your website. (XML SiteMap) • A convenient way to read the information in the site map file and convert it to an object model (SiteMapDataSource control and the XmlSiteMapProvider) • A way to use the site map information to display the user’s current position and give the user the ability to easily move from one place to another (Navigation Controls)
  • 3. • The starting point in site map-based navigation is the XmlSiteMapProvider which retrieves site map information from an XML file. • The XmlSiteMapProvider looks for a file named Web.sitemap in the root of the virtual directory. • XmlSiteMapProvider extracts the site map data and create the corresponding SiteMap object. • SiteMap object is then made available to the SiteMapDataSource, which you place on every page that uses navigation. • The SiteMapDataSource provides the site map information to navigation controls, which are the final link in the chain.
  • 4.
  • 5. Before you can fill in the content in your site map file, you need to understand the rules that all ASP.NET site maps must follow. • Rule 1: Site Maps Begin with the <siteMap> Element • Rule 2: Each Page Is Represented by a <siteMapNode> Element • Rule 3: A <siteMapNode> Element Can Contain Other <siteMapNode> Elements • Rule 4: Every Site Map Begins with a Single <siteMapNode> • Rule 5: Duplicate URLs Are Not Allowed
  • 6. <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"> <siteMapNode title="Home" description="Home" url="~/default.aspx"> <siteMapNode title="Information" description="Learn about our company“> <siteMapNode title="About Us“ description="How RevoTech was founded“ url="~/aboutus.aspx" /> <siteMapNode title="Investing“ description="Financial reports and investor analysis“ url="~/financial.aspx" /> </siteMapNode> <siteMapNode title="Products" description="Learn about our products"> <siteMapNode title="RevoStock“ description="Investment software for stock charting“ url="~/product1.aspx" /> <siteMapNode title="RevoAnalyze“ description="Investment software for yield analysis“ url="~/product2.aspx" /> </siteMapNode> </siteMapNode> </siteMap>
  • 7. You can create a site map using a text editor such as Notepad, or you can create it in Visual Studio by selecting Website ➤ Add New Item and then choosing the Site Map option. Once you’ve defined the Web.sitemap file, you’re ready to use it in a page the next step is to add the SiteMapDataSource control to your page. The last step is to add controls that are linked to the SiteMapDataSource. These are the three navigation controls: • TreeView • Menu • SiteMapPath
  • 8. Website navigation works best when combined with another ASP.NET feature—master pages. That’s because you’ll usually want to show the same navigation controls on every page. The easiest way to do this is to create a master page that includes the SiteMapDataSource and the navigation controls. You can then reuse this template for every other page on your site.
  • 9. The SiteMapPath provides breadcrumb navigation, which means it shows the user’s current location and allows the user to navigate up the hierarchy to a higher level using links.
  • 10. By breaking a single site map into separate files using the siteMapFile attribute, like this: <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode title="Root" description="Root" url="~/default.aspx"> <siteMapNode siteMapFile="Dealers.sitemap" /> <siteMapNode siteMapFile="Employees.sitemap" /> </siteMapNode> </siteMap>
  • 11. The site map model is designed around a simple principle: each entry has a separate URL. Although you can distinguish URLs by adding query string arguments, in many websites there is one-to-one correspondence between web forms and site map entries. ASP.NET has two tools that may be able to help you: • URL Mapping • URL Routing
  • 12. In some situations, you might want to have several URLs lead to the same page. This might be the case for a number of reasons—maybe you want to implement your logic in one page and use query string arguments but still provide shorter and easier-to-remember URLs to your website users. You define URL mapping in the <urlMappings> section of the web.config file. You supply two pieces of information—the request URL (as the url attribute) and the new destination URL (mappedUrl). <configuration> <system.web> <urlMappings enabled="true"> <add url="~/category.aspx" mappedUrl="~/default.aspx?category=default" /> <add url="~/software.aspx" mappedUrl="~/default.aspx?category=software" /> </urlMappings> ... </system.web> </configuration>
  • 13. Unlike URL mapping, URL routing doesn’t take place in the web.config file. Instead, it’s implemented using code. Typically, you’ll use the Application_Start() method in the global.asax file to register all the routes for your application. To register a route, you use the RouteTable class from the System.Web.Routing namespace. It provides a static property named Routes, which holds a collection of Route objects that are defined for your application. Initially, this collection is empty, but you can your custom routes by calling the MapPageRoute() method, which takes three arguments: routeName, routeUrl, physicalFile
  • 14. protected void Application_Start(object sender, EventArgs e) { RouteTable.Routes.MapPageRoute("product-details", "product/{productID}", "~/productInfo.aspx"); RouteTable.Routes.MapPageRoute("products-in-category", "products/category/{categoryID}", "~/products.aspx"); } Here’s a URL that uses this route to request a product with the ID FI_00345: http://localhost:[PortNumber]/Routing/product/FI_00345