We are using sitecore wildcard pages of 2 level down.

  • Products
    • productId*(wildcard item)
      • productName*(wildcard item)

We don't have products in sitecore repository. Its coming from 3rd party API.

Now, from URL : http://localhost/products/234/productName

On Context Item is there an easier way to get "234" other than myself manipulating url string to get 234.

wondering whether sitecore has stored this information some where in context

  • Easier than what? It sits in the url string
    – Mark Cassidy
    Commented Dec 14, 2016 at 14:55
  • wondering whether sitecore has this information in Context somewhere? Commented Dec 14, 2016 at 14:57
  • 1
    Not that I know.. I usually just get it from the url and keep it in my own context to re-use that info in all renderings
    – Gatogordo
    Commented Dec 14, 2016 at 15:19

2 Answers 2



The thing to keep in mind is that wildcard items are just regular items. When Sitecore resolves the item to use in a page request, if the URL looks like a path, Sitecore will descend through that path in the content tree until it finds the right item. The only thing special about wildcard items is that they will match any value for the corresponding portion of the URL.

Specifying a path in the URL is not the only way to render an item. For example, in your case, instead of using this URL:


You could access the same item like this:


You could also extend, or even completely override Sitecore's path resolution logic by implementing custom <getItem> and <resolvePath> pipeline processors. Then you'd be able to access the same item based on an arbitrary URL, e.g.


For these reasons, Sitecore context is very decoupled from the algorithms of path resolution.


There are no built-in means of getting wildcard parameter values from the URL.

Luckily, it's very easy to do this manually:

int segmentCount = this.Request.Url.Segments.Count();
var productId = this.Request.Url.Segments[segmentCount-2].Replace("/", string.Empty);
var productName = this.Request.Url.Segments[segmentCount-1].Replace("/", string.Empty);

With some sanitization and error handling added, this is the way to go for you.

  • Very well said. The important takeaway in practice is having handling for the url to not have the segments. For instance, you can allow support for experience editor on wild card items if your renderings gracefully handle segments not existing. Commented Jan 9, 2018 at 7:31

It does not.

While the URL parsing mechanism in Sitecore can get very cryptical at times, it basically happens like this:

  • Split up the URL, breaking on '/'
  • Recursively do GetItem/GetChild on each URL part
  • Return last item in chain

(note, this is a very simplified model).

Resolving Wildcards is something that is baked in deep into Sitecore's DataEngine. So deep it even takes you into the Nexus.

return Nexus.DataApi.ResolvePath(this.ItemPath, this.Database);

Essentially out of reach for code analysers and reflection tools. But it's there, one could sort of make it out in earlier builds of Sitecore. These days, all you get is an interface definition.

TL;DR - no. Sitecore does not store it, as in most cases Sitecore isn't even aware that it is resolving a Wildcard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.