URL Encode all non alpha numeric in C#

后端 未结 4 1419
轻奢々
轻奢々 2021-01-12 11:01

I need to fully URL Encode an email address.

HttpUtility.UrlEncode seems to ignore certain characters such as ! and .

I need to pass an email address in a ur

4条回答
  •  温柔的废话
    2021-01-12 11:28

    I've discovered a solution to this issue.

    .Net 4.0 has actually fixed the problem with special characters in the URI Template.

    This thread pointed me in the right direction. http://social.msdn.microsoft.com/Forums/en/dataservices/thread/b5a14fc9-3975-4a7f-bdaa-b97b8f26212b

    I added all the config settings and it worked. But note, it ONLY works with a REAL IIS setup with .Net 4.0. I can't seem to get it to work with the Visual Studio Dev IIS.

    Update - Actually, I tried removing those config settings and it still works. It maybe be that .Net 4.0 has fixed this problem by default.

提交回复
热议问题