472,374 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 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 3133
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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.