English 中文(简体)
Sitefinity WebSite to Web Application Project - app_code fun!
原标题:

I ve converted a SiteFinity (C#) app from a Website to a WebApplicationProject. It all works great..except

I used to have in my App_Code a class called MaterialsModule which inherits from the base class WebModule.

Problem: SiteFinity doesn t automagically see this class any more

I ve tried adding a namespace to the class and adding it to the code behind here (which is the page where I m expecting this MaterialModule page to show)

http://localhost/fmwebapp1/Sitefinity/Admin/Modules.aspx

public class MaterialsModule : WebModule
{
    public MaterialsModule()
    {
    }

    public override IList<Telerik.Web.IToolboxItem> Controls
    {
        get
        {
            return new List<IToolboxItem>(
                new ToolboxItem[]
                {
                    new CmsToolboxItem("~/Custom/Modules/Materials/Frontend/Controls/MaterialsList.ascx", "Materials", "Materials List", "Displays list of all materials")
                });
        } 
    }

    public override string Description
    {
        get { return "This is the Materials Module"; }
    }

    public override string Name
    {
        get { return "Materials"; }
    }

    public override string Title
    {
        get { return "Materials"; }
    }

    public override System.Web.UI.Control CreateControlPanel(System.Web.UI.TemplateControl parent)
    {
        return new MaterialsControlPanel();
    }
问题回答

You could try deleting the page.aspx.designer.vb file, then right-click the page.aspx and select "Convert to Web Application" to re-create the designer file. Of course, this assumes the problem is with that file.

In a web site project all assemblies in the ~/bin folder automatically get added to the GAC.

In a web application project, you need to explicitly define which assemblies are included in the GAC.

--

I believe you can fix this by adding Sitefinity s assembly references to your project.

To do this:

  1. Rght-click your project in the Solution Explorer
  2. Click Add References
  3. Browse for assemblies
  4. Navigate to the Sitefinity ~/bin folder
  5. Add references to the Sitefinity DLL files

WebModule should then be recognized as a defined class.

--

Good news, Sitefinity 4.0 (later this year) supports Web Application projects by default.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签