Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Prefer the new encoders over Uri.EscapeDataString #161

Closed
GrabYourPitchforks opened this issue Feb 22, 2015 · 1 comment
Closed

Prefer the new encoders over Uri.EscapeDataString #161

GrabYourPitchforks opened this issue Feb 22, 2015 · 1 comment

Comments

@GrabYourPitchforks
Copy link
Contributor

There are some call sites in this repo that invoke Uri.EscapeDataString. Instead of calling this static API, the caller should make an effort to use the IUrlEncoder that has been configured by the application developer, as it could have more permissive or restrictive logic than that of Uri.EscapeDataString.

If you have access to an IServiceProvider instance, import the Microsoft.AspNet.WebUtilities.Encoders namespace (in the Microsoft.AspNet.Http.Extensions package) and call the IServiceProvider.GetUrlEncoder() extension method

If you do not have access to an IServiceProvider, you can get a default static singleton instance of an IUrlEncoder via the UrlEncoder.Default static property (namespace Microsoft.AspNet.WebUtilities.Encoders, project Microsoft.AspNet.WebUtilities).

@blowdart blowdart added this to the 1.0.0-beta5 milestone Apr 5, 2015
@HaoK
Copy link
Member

HaoK commented Apr 24, 2015

87c31c5

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants