Question

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

Was it helpful?

Solution

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

OTHER TIPS

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

public partial class LinkedinMoreInfo : Authorisation.LinkedInBasePage {

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top