473,378 Members | 1,416 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Google SiteMap

Hello,

I am trying to convert an Asp.Net 2.0 XML sitemap file to a Google's
sitemap file.

I am posting the formats of both files.

1. How can I do the conversion?

2. And can I use an .ashx Asp.Net file that when the .ashx file is
called the Google XML file is generated?

Thank You,
Miguel

GOOGLE SiteMap

<?xml version="1.0" encoding="UTF-8"?>
< urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
< url>
< loc>http://www.mydomain.com/example.aspx</loc>
< lastmod>2005-01-01</lastmod>
< changefreq>daily</changefreq>
< priority>0.8</priority>
</url>
</urlset>

ASP.NET 2.0 Site Map

<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/example.aspx"
changefreq = "daily"
lastmod = "2005-01-01"
description = "My example page and its contents"
priority = "0.8"
title = "Example page" />
</siteMapNode>
</siteMap>

Note: description and title should be droped when converting from
Asp.Net to Google sitemap.

Oct 8 '06 #1
4 3243
Have you seen this?

http://www.gotdotnet.com/codegallery...b-e486dd598604

"This project builds Google (tm) compatible sitemap files from ASP.NET
SiteMaps. A simple control that exposes ASP.NET SiteMaps as HTML to help
other search engines index the site is also provided."
"shapper" <md*****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hello,

I am trying to convert an Asp.Net 2.0 XML sitemap file to a Google's
sitemap file.

I am posting the formats of both files.

1. How can I do the conversion?

2. And can I use an .ashx Asp.Net file that when the .ashx file is
called the Google XML file is generated?

Thank You,
Miguel

GOOGLE SiteMap

<?xml version="1.0" encoding="UTF-8"?>
< urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
< url>
< loc>http://www.mydomain.com/example.aspx</loc>
< lastmod>2005-01-01</lastmod>
< changefreq>daily</changefreq>
< priority>0.8</priority>
</url>
</urlset>

ASP.NET 2.0 Site Map

<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/example.aspx"
changefreq = "daily"
lastmod = "2005-01-01"
description = "My example page and its contents"
priority = "0.8"
title = "Example page" />
</siteMapNode>
</siteMap>

Note: description and title should be droped when converting from
Asp.Net to Google sitemap.

Oct 8 '06 #2
Here's a handler that should get you going.

Ken
Microsoft MVP [ASP.NET]

<%@ WebHandler Language="VB" Class="googlesitemap" %>
' googlesitemap.ashx
' Adapted from a C# version in
' ASP.NET 2.0 Unleashed
' http://www.superexpert.com/Books/Asp...d/Default.aspx
' by Ken Cox [MVP - ASP.NET]
Imports System.Web
Imports System.Xml
Imports System.Text
Imports System.IO

Public Class googlesitemap : Implements IHttpHandler
Private xmlwtr As XmlWriter
Public Sub ProcessRequest _
(ByVal context As HttpContext) _
Implements IHttpHandler.ProcessRequest
context.Response.ContentType = "text/xml"
Dim settings As XmlWriterSettings = _
New XmlWriterSettings()
settings.Encoding = Encoding.UTF8
settings.Indent = True
xmlwtr = XmlWriter.Create _
(context.Response.OutputStream, settings)
xmlwtr.WriteStartDocument()
xmlwtr.WriteStartElement _
("urlset", "http://www.google.com/schemas/sitemap/0.84")
' Add root node
AddUrl(SiteMap.RootNode)
' Add all other nodes
Dim nodes As SiteMapNodeCollection = _
SiteMap.RootNode.GetAllNodes()
For Each node As SiteMapNode In nodes
AddUrl(node)
Next node

xmlwtr.WriteEndElement()
xmlwtr.WriteEndDocument()
xmlwtr.Flush()
End Sub

Private Sub AddUrl(ByVal node As SiteMapNode)
' Skip empty Urls
If String.IsNullOrEmpty(node.Url) Then
Return
End If
' Skip remote nodes
If node.Url.StartsWith("http", True, Nothing) Then
Return
End If
' Open url tag
xmlwtr.WriteStartElement("url")
' Write location
xmlwtr.WriteStartElement("loc")
xmlwtr.WriteString(GetFullUrl(node.Url))
xmlwtr.WriteEndElement()
' Write last modified
xmlwtr.WriteStartElement("lastmod")
xmlwtr.WriteString(GetLastModified(node.Url))
xmlwtr.WriteEndElement()
' Write changefreq
xmlwtr.WriteStartElement("changefreq")
xmlwtr.WriteString("daily")
xmlwtr.WriteEndElement()
' Write priority
xmlwtr.WriteStartElement("priority")
xmlwtr.WriteString("0.8")
xmlwtr.WriteEndElement()
' Close url tag
xmlwtr.WriteEndElement()
End Sub

Private Function GetFullUrl _
(ByVal url As String) As String
Dim context As HttpContext = HttpContext.Current
Dim server As String = _
context.Request.Url.GetComponents _
(UriComponents.SchemeAndServer, UriFormat.UriEscaped)
Return Combine(server, url)
End Function

Private Function Combine _
(ByVal baseUrl As String, _
ByVal url As String) As String
baseUrl = baseUrl.TrimEnd(New Char() {"/"c})
url = url.TrimStart(New Char() {"/"c})
Return baseUrl & "/" & url
End Function

Private Function GetLastModified _
(ByVal url As String) As String
Dim context As HttpContext = HttpContext.Current
Dim physicalPath As String = _
context.Server.MapPath(url)
Return File.GetLastWriteTimeUtc _
(physicalPath).ToString("s")
End Function

Public ReadOnly Property IsReusable() _
As Boolean Implements IHttpHandler.IsReusable
Get
Return True
End Get
End Property

End Class

"shapper" <md*****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hello,

I am trying to convert an Asp.Net 2.0 XML sitemap file to a Google's
sitemap file.

I am posting the formats of both files.

1. How can I do the conversion?

2. And can I use an .ashx Asp.Net file that when the .ashx file is
called the Google XML file is generated?

Thank You,
Miguel

GOOGLE SiteMap

<?xml version="1.0" encoding="UTF-8"?>
< urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
< url>
< loc>http://www.mydomain.com/example.aspx</loc>
< lastmod>2005-01-01</lastmod>
< changefreq>daily</changefreq>
< priority>0.8</priority>
</url>
</urlset>

ASP.NET 2.0 Site Map

<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/example.aspx"
changefreq = "daily"
lastmod = "2005-01-01"
description = "My example page and its contents"
priority = "0.8"
title = "Example page" />
</siteMapNode>
</siteMap>

Note: description and title should be droped when converting from
Asp.Net to Google sitemap.

Oct 8 '06 #3
re:
I am trying to convert an Asp.Net 2.0 XML sitemap file to a Google's sitemap file.
Try the ASP.NET to Google sitemap converter:
http://sourceforge.net/projects/sitemap-asp2goo/

The download link is :
http://prdownloads.sourceforge.net/s...1.zip?download

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"shapper" <md*****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hello,

I am trying to convert an Asp.Net 2.0 XML sitemap file to a Google's
sitemap file.

I am posting the formats of both files.

1. How can I do the conversion?

2. And can I use an .ashx Asp.Net file that when the .ashx file is
called the Google XML file is generated?

Thank You,
Miguel

GOOGLE SiteMap

<?xml version="1.0" encoding="UTF-8"?>
< urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
< url>
< loc>http://www.mydomain.com/example.aspx</loc>
< lastmod>2005-01-01</lastmod>
< changefreq>daily</changefreq>
< priority>0.8</priority>
</url>
</urlset>

ASP.NET 2.0 Site Map

<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/example.aspx"
changefreq = "daily"
lastmod = "2005-01-01"
description = "My example page and its contents"
priority = "0.8"
title = "Example page" />
</siteMapNode>
</siteMap>

Note: description and title should be droped when converting from
Asp.Net to Google sitemap.

Oct 8 '06 #4
Hi,

I saw the links. However, I am trying to do the following:
Each web project will have only one web site map file for each culture.
Inside each node of the web site map I add a attribute such as:

Google=True
or
Footer=True

This way I will be able to use those values to generate Google XML web
sites maps on the fly with an ashx file or even get nodes from the web
site map in my runtime code to fill the footer.

This way I don't have to mantain many web sitemaps.

This is way I am trying to figure out how to make the XML conversion
with XLST and using conditions to.

Thanks,
Miguel
Juan T. Llibre wrote:
re:
I am trying to convert an Asp.Net 2.0 XML sitemap file to a Google's sitemap file.

Try the ASP.NET to Google sitemap converter:
http://sourceforge.net/projects/sitemap-asp2goo/

The download link is :
http://prdownloads.sourceforge.net/s...1.zip?download

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"shapper" <md*****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hello,

I am trying to convert an Asp.Net 2.0 XML sitemap file to a Google's
sitemap file.

I am posting the formats of both files.

1. How can I do the conversion?

2. And can I use an .ashx Asp.Net file that when the .ashx file is
called the Google XML file is generated?

Thank You,
Miguel

GOOGLE SiteMap

<?xml version="1.0" encoding="UTF-8"?>
< urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
< url>
< loc>http://www.mydomain.com/example.aspx</loc>
< lastmod>2005-01-01</lastmod>
< changefreq>daily</changefreq>
< priority>0.8</priority>
</url>
</urlset>

ASP.NET 2.0 Site Map

<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/example.aspx"
changefreq = "daily"
lastmod = "2005-01-01"
description = "My example page and its contents"
priority = "0.8"
title = "Example page" />
</siteMapNode>
</siteMap>

Note: description and title should be droped when converting from
Asp.Net to Google sitemap.
Oct 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Bob Bedford | last post by:
I've a question about generating pages for search engines. It's possible to detect a bot coming on a website and then show a complete other page for it ? My main page is mainly graphic, with a...
7
by: JJ | last post by:
I'm playing aournd with my first asp.net 2.0 web site and looking at the Web.sitemap file. It seems there's a lot of publicity at the moment about Google's sitemaps and how they are supposed to...
5
by: JJ | last post by:
Although this question involves Flash, I suspect the actual issue is an asp one.. I am trying to open the web.sitemap file in an .swf file enbedded in an asp page (I'm working in VS 2005). I...
1
by: Luca88 | last post by:
Easy to use, install and configure, this is a php script that allows the generating of the sitemap.xml (xml sitemap requested by “Google Sitemap System”) in real time. Together with a custom...
4
by: shapper | last post by:
Hello, I have 2 questions about Asp.Net 2.0 web.sitemap: 1. Where can I find the list of all siteMapNode attributes? I looked eveywhere and couldn't find it. 2. I created a Web.sitemap...
6
by: shapper | last post by:
Hello, I have on my web site an Asp.Net 2.0 web.sitemap file. How can I convert it to a Google's sitemap file? Thanks, Miguel
6
by: shapper | last post by:
Hello, If you make a search in Google for "CNN" you will get the result as follows: CNN.com - Breaking News, US, World, Weather, Entertainment & Video ... CNN.com delivers the latest...
5
by: Tim Mackey | last post by:
hi, i have put my web.sitemap in /App_Data so i can edit it programatically via a web admin page, inheriting the modify permissions from the App_Data folder etc. i was hoping the provider would...
20
by: tatata9999 | last post by:
The first generation of web site search engine hands-down is google. A majority of these web sites are static page -driven html pages. Now, I would think more and more web-based applications are...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.