How to get Uri.EscapeDataString to comply with RFC 3986

后端 未结 5 1427
死守一世寂寞
死守一世寂寞 2020-11-30 04:07

The Uri class defaults to RFC 2396. For OpenID and OAuth, I need Uri escaping consistent with RFC 3986.

From the System.Uri class documentation:

5条回答
  •  旧巷少年郎
    2020-11-30 04:43

    I realize this question and answers are a few years old, but I thought I would share my finding when I had trouble getting compliance under .Net 4.5.

    If your code is running under asp.net, just setting the project to target 4.5 and running on a machine with 4.5 or later, you may still get 4.0 behavior. You need to ensure is set in the web.config.

    From this blog article on msdn,

    If there is no attribute present in Web.config, we assume that the application wanted 4.0 quirks behavior.

提交回复
热议问题