.comment-link {margin-left:.6em;}

kHSw

Monday, August 09, 2004

The Sharepoint User-Agent

We are developing a CMS-website that's being indexed by Sharepoint.
If, for instance, a user visits a CMS-posting with a link to a Sharepoint document, a frameset is build and that document is opened within the frameset automatically. The user doesn't have to click on the link to that document.
But when Sharepoint is indexing the website, the redirect can't be performed as Sharepoint has to be able to read the meta-tags on that posting.
So we had to make an exclusion for Sharepoint. We did some small research and we found out that the User-Agent Sharepoint is using is called "MS Search".

We wrote a little function that we could call to find out if Sharepoint is crawling our CMS-website:


Public Shared Function SharePointIsCrawling() As Boolean
Return (Web.HttpContext.Current.Request.UserAgent = "MS Search")
End Function


To be able to test this, we adapted the function so that we could pretend to be Sharepoint with a little registry-hack (by replacing the default empty value of "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent" to "MS Search"):

Public Shared Function SharePointIsCrawling() As Boolean
Return (UCase(Web.HttpContext.Current.Request.UserAgent).IndexOf("MS SEARCH") > -1)
End Function


Pretty easy...

0 Comments:

Post a Comment

<< Home


 
Stefanie Worm is het liefste vrouwtje van de wereld.
Melina is de liefste schatsie van de wereld (Erik De Maeyer).