Aside from writing custom code are there any existing features in .NET which allows me to parse information from part of a URL? So my input will be like the below:
\Shop-Pet\Dog\Large\Africa-Lionhound\27-80?color-Dark
Is there a any easy way instead of using string split and/or regex afterwards to extract information into an array like the below:
[shop,pet]
[PetType, Dog]
[BreedSize, Large]
[Country, Africa]
[OtherNames, Lionhound]
[Height, 27]
[Weight, 80]
Thanks
While not exactly what you need,
Request.Url.Segmentswill return a string array of the different segments available to you. Given your example:/Shop-Pet/Dog/Large/Africa-Lionhound/27-80?color-Dark
it would return something to you like
You would have to handle the QueryString separately.
I don’t think there’s anything specifically like what you want, but Routes which are available in ASP.NET 4.0 could probably be setup to handle things exactly like you wanted.