2

AppSettings にアクセスするために太陽の下ですべてを試しましたが、これを機能させることができません。

Web AppSettings へのアクセスが必要なクラス ライブラリがあります。確認したところ、インポートする「System.Collections.Specialized.NameValueCollection」はありません 。

誰でもアイデアはありますか?

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Configuration;

public static class httpresponsebase_setoauthfromcookie
{
    public static void SetOauthFromCookie(this HttpResponseBase response, string verify,
                                          string token, string tokenSecret,
                                          string userName,
                                          bool isTwitter)
    {


        string pas =  WebConfigurationManager.AppSettings["cryptpass"],
               crypt = ((verify.Length > 3 ? (verify + ":") : "twit") + token + ":" + tokenSecret).Encrypt(pas);
        //
        var cookie = new HttpCookie(userName + (isTwitter ? "twitter" : "linkedin"), HttpServerUtility.UrlTokenEncode(Convert.FromBase64String(crypt)));
        cookie.Expires = DateTime.Now.AddDays(1);
        response.Cookies.Add(cookie);
    }}

ここに画像の説明を入力

4

1 に答える 1

3

System 4.0 への参照を追加したところ、すべてが修正されました。

于 2013-08-12T18:59:54.410 に答える