Webクライアントを介して別のシステムに送信するメソッドに渡される名前値のコレクションがあります。NameValueCollectionの値をエンコードするC#.net
public string DoExtendedTransferAsString(string operation, NameValueCollection query, FormatCollection formats)
{
System.Net.WebClient client = new System.Net.WebClient();
client.QueryString = query;
client.QueryString["op"] = operation;
client.QueryString["session"] = SessionId;
using (Stream stream = client.OpenRead(url))
{
FormatCollection formats = new FormatCollection(stream);
}
return formats;
}
私はNameValueCollectionの内側のすべての値でHttpUtility.HtmlEncodeを実行する必要がありますが、私はどのようにわからないと思います。注:NameValueCollectionでなければならないので、呼び出しコードを変更することはできません。 MSDNから
おかげ
@Liviu Mは私が特定されていたと思った申し訳ありませんが、私はNameValueCollectionの中の値にこれをやってみたいしてみてください。私はしようとしました(int i = 0; i
Cookie