1

リクエスト Cookie の情報をチェックするこの拡張メソッドがあります。探しているこの情報が Cookie にない場合は、データベースにアクセスします。

これはすべて問題ありませんが、この拡張機能を作成したときに MVC4 アプリケーションで設計しました。現在、アイテムを相対ライブラリにリファクタリングしていますが、クラス ライブラリへの参照をインポートまたは追加する方法が見つからないようです。 HttpResponseException をスローします。

これを克服する方法についてのアイデアはありますか?

    namespace LinkedIn.Extensions
{
    public static class httprequest_linkedincontext
    {
        /// <summary>
        /// Extension that creates a OAuthLinkedIn object by checking the cookie first, and if the cookie has no LinkedIn info or has expried then builds the LinkedIn OAuthLinkedIn from the database.
        /// </summary>
        /// <param name="request"></param>
        /// <param name="userName"></param>
        /// <returns>oAuthLinkedIn information</returns>
        public static oAuthLinkedIn GetLinkedInContext(this HttpRequestMessage request, string userName)
        {
            OAuthHelper helper = new OAuthHelper(request, userName, false);
            oAuthLinkedIn oauth = new oAuthLinkedIn(helper.Verify, helper.Token, helper.TokenSecret);

            if (string.IsNullOrEmpty(oauth.Token) || string.IsNullOrEmpty(oauth.TokenSecret))
            {
                throw new System.Web.Http.HttpResponseException(new HttpResponseMessage(System.Net.HttpStatusCode.NotFound));
            }
            return oauth;
        }
    }
}

現在、System.Web.Http.HttpResponseException の Http の下に小さな赤い波線があります。

4

0 に答える 0