public TagBE GetTagFromPathSegment(string tagPathSegment) { TagBE tag = null; uint id = 0; string tagId = tagPathSegment; if (uint.TryParse(tagId, out id)) { tag = _session.Tags_GetById(id); } else { if (tagId.StartsWith("=")) { string prefixedName = tagId.Substring(1); prefixedName = XUri.Decode(prefixedName); TagBE tmpTag = ParseTag(prefixedName); tag = _session.Tags_GetByNameAndType(tmpTag.Name, tmpTag.Type); } } if (tag != null) { IList <TagBE> tags = new List <TagBE>(); tags.Add(tag); tags = FilterDisallowed(tags); if (tags.Count == 0) { tag = null; } } if (tag == null) { throw new TagNotFoundException(); } return(tag); }