コード例 #1
0
        protected override string DecodeUrlToken(string urlToken)
        {
            if (!string.IsNullOrEmpty(urlToken))
            {
                urlToken = Uri.UnescapeDataString(urlToken).Replace(EncodedDelimiter, UrlTokenDelimiter);
                urlToken = urlToken.Replace('-', ' ');
                EncodingTokenList.ForEach(t => urlToken = urlToken.Replace(t.EncodedDelimiter, t.Delimiter));
            }

            return(urlToken);
        }
コード例 #2
0
        protected override string EncodeUrlToken(string urlToken, bool removeInvalidPathCharacters)
        {
            if (!string.IsNullOrEmpty(urlToken))
            {
                if (removeInvalidPathCharacters)
                {
                    foreach (string invalidPathCharacter in _invalidPathCharacters)
                    {
                        urlToken = urlToken.Replace(invalidPathCharacter, string.Empty);
                    }
                }
                EncodingTokenList.ForEach(t => urlToken = urlToken.Replace(t.Delimiter, t.EncodedDelimiter));
                urlToken = urlToken.Replace(' ', '-');
                urlToken = Uri.EscapeDataString(urlToken).Replace(UrlTokenDelimiter, EncodedDelimiter);
            }

            return(urlToken);
        }