If the product name contains a % sign you get an error
E.g. Black Shoes 100% leather
gives you
Server Error in '/' Application.
--------------------------------------------------------------------------------
HTTP Error 400 - Bad Request.
slug = HttpUtility.UrlEncode(slug);
public virtual string FindSlug(int entityId, string entityName,int languageId)
{
string key = string.Format(URLRECORD_BY_ID_NAME_LANGUAGE_KEY, entityId, entityName, languageId);
return _cacheManager.Get(key, () =>
{
var query = from ur in _urlRecordRepository.Table
where ur.EntityId == entityId &&
ur.EntityName == entityName &&
ur.LanguageId == languageId
select ur.Slug;
var slug = query.FirstOrDefault();
//little hack here. nulls aren't cacheable so set it to ""
if (slug == null)
slug = "";
slug = HttpUtility.UrlEncode(slug);
return slug;
});
}