문제

I am working on an asp.net web app, and I have few classes in my app_code, but for some reason I can't use any of them in my code. I tried using the same namespace, I tried without any namespace in both files, but nothing helps.

This is my page code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LinkedIn;
using LinkedIn.ServiceEntities;


namespace Authentication
{
    public partial class LinkedinMoreInfo : LinkedinBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

And my code in the class:

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Xml.Linq;

using LinkedIn;

namespace Authorisation
{
    public class LinkedInBasePage : System.Web.UI.Page
    {
        private string AccessToken
        {
            get { return (string)Session["AccessToken"]; }
            set { Session["AccessToken"] = value; }
        }

        private InMemoryTokenManager TokenManager
        {
            get
            {
                var tokenManager = (InMemoryTokenManager)Application["TokenManager"];
                if (tokenManager == null)
                {
                    string consumerKey = ConfigurationManager.AppSettings["LinkedInConsumerKey"];
                    string consumerSecret = ConfigurationManager.AppSettings["LinkedInConsumerSecret"];
                    if (string.IsNullOrEmpty(consumerKey) == false)
                    {
                        tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
                        Application["TokenManager"] = tokenManager;
                    }
                }

                return tokenManager;
            }
        }

        protected WebOAuthAuthorization Authorization
        {
            get;
            private set;
        }

        protected override void OnLoad(EventArgs e)
        {
            this.Authorization = new WebOAuthAuthorization(this.TokenManager, this.AccessToken);

            if (!IsPostBack)
            {
                string accessToken = this.Authorization.CompleteAuthorize();
                if (accessToken != null)
                {
                    this.AccessToken = accessToken;

                    Response.Redirect(Request.Path);
                }

                if (AccessToken == null)
                {
                    this.Authorization.BeginAuthorize();
                }
            }

            base.OnLoad(e);
        }
    }
}

Any idea what can be the problem? Thanks in advance

도움이 되었습니까?

해결책

Go into the properties of the files, and change the Build Action to Compile

다른 팁

If your base page is name LinkedInBasePage, then you need to inherit from LinkedInBasePage instead of LinkedinBasePage

public partial class LinkedinMoreInfo : Authorisation.LinkedInBasePage {

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top