ASP.NET Sitemap Editor

ASP.NET Sitemap Deutsche Version

Due to many request, I tried to translate the German version of that page. This web (MSXFAQ) is primärily an exchange community and FAQ web and not a developer resource. But I was using FrontPage 2003 a long time and switched now to Sharepoint designer. Both products are able to define a "navigation". Unfortunaly the built in controls to use that navigation structure are not really useful und flexible. So I wrote some VBA Macros to generate the menus manually.

Many people asked me about my web and how i maintain such a large structure. If you use ASP.NET, you should know about the sitemap features of asp.net. You can define a web structure as XML-file and us it für dynamic sitemaps and navigation. Unfortunaly there is no editor für that file, so you have to use notepad or any other XML-Editor. Not really useful and safe

So I took my knowledge about VBA and the FrontPage/Sharepoint Designer object model and wrote a small VBA-Macro, to convert the Navigation-Sheet into a XML-File.

Navigation and Sitemap

So first start FrontPage or Sharepoint Designer and add your pages into the navigation sheet.

Frontpage/SPD Sitemap

Unfortunaly this feature is not present in Expression Web. even if Microsoft recommends expression Web as primäry application to design ASP.NET pages. Maybe they will change that later. FrontPage and Sharepoint Designer are storing that Navigation not as a sitemap-file. they use a "structure.cnf" File (See FrontPage Struktur).

ASP-Sitemap-VBA Macro Download und setup

Converting that navigation into a ASP-NET-compatible SITEMAP-File is easy. You can use the following VBA-Macro. It can be used with FrontPage and Sharepoint Designer.

aspnetsitemap.bas.txt
Download that file and save it with extension ".BAS"

VBA-Macros are normally not encrypted or compiled. So simply have a look at the source to make sure, that does not destroy anything. This Macro parses the Navigation structure of the current web and stores it as a new XML-File ""web.sitemap" into the root of the current web. An existing file will be overwritten

Start FrontPage or Sharepoint Designer, open your web and start the Macro Editor (Hotkey: ALT-F11). Now import the downloaded BAS-File

VBA-Makroeditor

The VBA-macro is now a new modul in your VBA Space. Simply place the cursor onto "Sub ASPSiteMap()" and start the macro.

Run Makro

If everything is fine, you can see the debug output in the lower pane.

Notice:
The VBA-Macro is not bound to the current web. It's stored in the User profile and can be used für any currently open web..

Performance ?: I', running this Macro on a old slow IBM Notebook (Pentium Mobile) and it takes only a few second to process over 900 pages, if Sharepoint designer has already loaded the navigation. Otherwise it takes less than a minute.

This is a "Client Macro". So you have to start it, if you changed your navigation and want to rebuild the sitemap.

How to create a Web

So the process of creating a ASP-NET Web looks like:

  • Create a Web with Visual Studio Web Edition Express
    You can use your favorite IDE but if you do not own the full blown Visual Studio, you can still use "Visual Studio Web Edition Express" to create an empty web of a new project based on a template.
  • Web Design and Layout
    I'm not a native HTML/CSS speaking person. So I use my favorite graphics package (have you seen Expression Blend ?) and HTML-Editor (I use Sharepoint Designer) to create images, Stylesheets master pages, the navigation tree and more.
    The last step runs the VBA-Macro to generate the sitemap XML.
  • Coding in Visual Studio
    No I go back to Visual Studio and add the required code and business logic. And I can simply add all the components für menus, breadcrumbs etc.

Of course it's you own decision, how to maintain and edit our web page.

personal wished

For me, I can't really understand, why Microsoft is offering the "Expression" Series für building webs, graphics and more and why the<y missed a feature to write asp-net Sitemaps. So I hope, they will add the navigation sheet to expressions web and store the structure in the SITEMAP-File instead a old style INI-File

Additional Links