Developer forum

Forum » Development » Casing in URL Providers

Casing in URL Providers

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
Hi there,

I built a simple URL provider to convert something like &CollectionName=Name to /Name. I use the following code:

foreach (var collection in collections)
{
  list.Add(new Mapping("CollectionName", collection.CollectionName, collection.CollectionName));
}

This works fine. But as soon as I do this:

foreach (var collection in collections)
{
  list.Add(new Mapping("CollectionName", collection.CollectionName.ToLower(), collection.CollectionName.ToLower()));
}

(e.g. convert both sides to lower case), the URL is no longer parsed and I end up with &CollectionName again. It also works when I just convert the UrlName:

foreach (var collection in collections)
{
  list.Add(new Mapping("CollectionName", collection.CollectionName, collection.CollectionName.ToLower()));
}

Is this a bug, or is this by design? I can work around it by not converting the ParameterValue, but I was just wondering what's going on here.

Imar

Replies

 
Vladimir
Reply
Hi Imar,
It's implemented according design.
I think it's done so, because parameterValue as rule is used to find values​​ in DB.
For example, in the case of case-sensitive search in the database, our query would be
select * from myTable where keyID = parameterValue,
without any transformation of keyID to lowercase.
For search in array, hash and so on it also maybe useful

Vladimir

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Right, that makes sense. Thanks...

Imar
 

 
Nicolai Høeg Pedersen
Reply
And I believe that turning on case insensitive in the control panel will lower case it for you...

 

You must be logged in to post in the forum