I am starting to realise that there are about a bazillion different methods for encoding urls in .NET. I keep finding new ones. They all work slightly differently, but they all have essentially the same summary comments.
Does anyone have a definitive matrix that shows the exact differences between the following methods:
HttpUtility.UrlEncode
HttpUtility.UrlPathEncode
Server.UrlEncode
Uri.EscapeUriString
Uri.EscapeDataString
... are they any more?
Also it would be good to match these up with use-cases e.g.:
- Urls in href attributes of a tags
- Urls to be displayed to the user in HTML
- Urls as querystring values (i.e. to be sent in GET requests)
- Urls to be sent in POST requests etc