Use only web safe characters in client state arg

Fixes #268
Fixes compile error on .NET 3.5
Merge branch 'v4.1' into v4.2
Merge branch 'v4.2' into v4.3