为什么我不能在我的代码asp.net c#中使用app_code中的代码文件
发布时间:2020-05-24 11:44:41 所属栏目:asp.Net 来源:互联网
导读:我正在开发一个asp.net网络应用程序,我的app_code中有几个类,但由于某种原因,我不能在我的代码中使用它们中的任何一个.我尝试使用相同的命名空间,我尝试在两个文件中没有任何命名空间,但没有任何帮助. 这是我的页面代码: using System;using System.Collecti
|
我正在开发一个asp.net网络应用程序,我的app_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)
{
}
}
}
我在课堂上的代码: 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);
}
}
}
知道可能是什么问题吗? 解决方法进入文件的属性,并将Build Action更改为Compile(编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 在Asp.net中运行外部可执行文件的内存限制
- asp.net – Orchard CMS是否支持移动呈现?
- 使用ASP.NET Web服务的jQuery AutoComplete(jQuery UI 1.8r
- asp.net-mvc – 为什么Chrome在ASP.NET MVC中提供文件时搜索
- asp.net-mvc – 准备我的ASP.NET/MVC网站使用SSL?
- asp.net-mvc – ASP.NET MVC / IIS 7.5:500内部服务器仅针
- asp.net下使用jquery 的ajax+WebService+json 实现无刷新取
- asp.net核心 – Kestrel托管基础
- asp.net – 网站和虚拟目录之间有什么区别
- asp.net-mvc – 从MVC5框架OAuth/OWin身份提供程序与外部au
推荐文章
站长推荐
- ASP.NET CheckBoxList DataBinding问题
- 使用Asp.net核心将PDF返回到浏览器
- asp.net-mvc – 如何从ActionResult获取模型?
- asp.net – 如何摆脱丑陋的asp:菜单闪烁?
- asp.net-core – 如何使用ASP.NET注册OData 5
- asp.net – visual studio 2017调试无法启动程序
- asp.net-mvc – 如何使用asp.net mvc razor在视图
- asp.net-mvc – DataAnnotations StringLength属
- asp.net – 如何在CORS中解决’预检无效(重定向)
- asp.net-mvc – 使用Razor在ASP.NET MVC3中的文件
热点阅读
