private IEnumerable<string> GetUrlVariables(string path)
{
var components = path.Split(PathSeparatorChars);
foreach (var component in components)
{
if (IsNullOrEmpty(component))
{
continue;
}
if (component.Contains(VariablePrefix) || component.Contains(VariablePostfix))
{
var variableName = component.Substring(1, component.Length - 2);
// Accept only variables matching this format: '/{property}/'
// Incorrect formats: '/{property/' or '/{property}-some-other-text/'
// I'm not sure that the second one will be parsed correctly at server side.
if (component[0] != VariablePrefixChar || component[component.Length - 1] != VariablePostfixChar || variableName.Contains(VariablePostfix))
{
this.AppendError("Component '{0}' can not be parsed".Fmt(component));
continue;
}
yield return variableName;
}
}
}