简体   繁体   English

asp.net-Web应用程序与网站-代码背后

[英]asp.net - web app vs web site - code behind

I have a asp.net website that was built a while back. 我有一个早已建立的asp.net网站。 I have went through the process of converting it with visual studio into a web app. 我已经经历了使用Visual Studio将其转换为Web应用程序的过程。 Now that I have it converted I am having some trouble using classes from a class library that is added to the project. 现在,我已经对其进行了转换,在使用添加到项目中的类库中的类时遇到了一些麻烦。 The code behind is slightly different (below). 后面的代码略有不同(如下)。 Can anyone give me suggestion on a solution. 谁能给我关于解决方案的建议。

--to clearify a little I have 3 visual studio projects -为了澄清一点,我有3个Visual Studio项目

1 class library (data access layer) 1 class library (business logic layer) 1 website (presentation layer)-> which I converted into a web app project. 1个类库(数据访问层)1个类库(业务逻辑层)1个网站(表示层)->我转换为Web应用程序项目。 with a process similar to this ( here ) 具有与此类似的过程( 此处

I have a static method inside of the business logic layer that I can no longer access from the code behind in my presentation layer. 我在业务逻辑层中有一个静态方法,无法再通过表示层中的代码访问。

---- Web site -- /Profile/Default.aspx ----网站-/Profile/Default.aspx

using MyBusinessLogic;
public partial class Profile_Default : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        MyBusinessLogic.Profiles.GetUserInfo(UserName);
    }
}

---- Web app -- /Profile/Default.aspx ---- Web应用程序-/Profile/Default.aspx

using MyBusinessLogic;
namespace WebApplication1.Profile
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            MyBusinessLogic.Profiles.GetUserInfo(UserName); <---ERROR "can not access method on namespace"----------------------
        }
    }
}

I have faced similar issue in conversions. 我在转换中也遇到过类似的问题。 Please check for similar namespaces (Mybusinesslogic.Profiles) if you have resharper, just write profile.getuserinfo and check if it resolves to your correct business logic assembly or you have another duplicate existing in current namespace. 如果您有共享工具,请检查类似的名称空间(Mybusinesslogic.Profiles),只需编写profile.getuserinfo并检查它是否可以解析为正确的业务逻辑程序集,或者当前名称空间中是否存在另一个重复项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM