Thursday 12 April 2007

Determining the current variation

If you need to find out which variation a client has requested, this code might do the trick.

Start by getting the current VariationLabel; then compare its title against a known variation title.


VariationLabel currentVariation = PublishingWeb.GetPublishingWeb
(SPContext.Current.Web).Label;

if (currentVariation != null &&
currentVariation.Title.ToLowerInvariant () ==
"au")
{
//do something
}

No comments:

Post a Comment

Spam comments will be deleted

Note: only a member of this blog may post a comment.