Converts all characters, except RFC 2396 reserved except '?' and unreserved characters, to their hexadecimal representation. This is equivalent to escaping all but RFC 2396 pchar characters in an abs_path. Use this method to escape paths in URI's. All Unicode characters are converted to UTF-8 format before being escaped. There must be no escaped characters in the string.

Namespace:  EPiServer
Assembly:  EPiServer (in EPiServer.dll) Version: 5.2.375.236


public static string EscapeUriSegments(
	string s


Type: System..::.String
The string to escape

Return Value

The encoded representation


This method differs from Uri.EscapeUriString in that it also encodes '#', which although documented as doing, Uri.EscapeUriString does not. This is either a code-defect or a documentation issue in .NET framework 2.0. It also differs in that it encodes '?' and '&', wich Uri.EscapeUriString does not claim to do, nor does. Note that this method does not allow the use of '/' in the separate segments. Use System.Uri.UnescapeDataString to get the original string back.

See Also