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
<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.