More in this section

Forums / Developing with Sitefinity / Adding External Pages That Use Compiled Code

Adding External Pages That Use Compiled Code

7 posts, 0 answered
  1. Paul Dench
    Paul Dench avatar
    19 posts
    Registered:
    26 Oct 2009
    18 Dec 2009
    Link to this post
    Hi,

    I have successfully set up my site with the pages that will be updateable for the business users. Now I am trying to add the pages that contain custom code, that will not be updateable. These pages use compiled code-behind, and when I add them, I get errors that say "Could not load type 'Registration'.". The code looks like this:

    Line 1:  <%@ page language="C#" masterpagefile="app_master/subpage.master" autoeventwireup="true" inherits="Registration" title="GL Advisor : We Provide Solutions" maxPageStateFieldLength="2048" %>

    I've put the "compiled" files in the bin folder, but it still doesn't work for me. Any suggestions about what I am doing wrong?

    Thanks!
    Paul
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    18 Dec 2009
    Link to this post
    Hi Paul Dench,

    Does the compiled class belong to some name space. For example it you have the class generrated in assembly MyAssembly and the naspace is MyAssembly.CustomCode can you try like this:
    <%@ page language="C#" masterpagefile="app_master/subpage.master" autoeventwireup="true" inherits="MyAssembly.CustomCodeRegistration, MyAssembly" title="GL Advisor : We Provide Solutions" maxPageStateFieldLength="2048" %>


    All the best,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Paul Dench
    Paul Dench avatar
    19 posts
    Registered:
    26 Oct 2009
    18 Dec 2009
    Link to this post
    Hi,

    Thanks for the quick reply. This page belongs to the global namespace, so that shouldn't be an issue. When I incorporated this page into the Sitefinity project, I simply uploaded the file and didn't do anything else (other than copying files from the bin folder of the existing project into the Sitefinity bin folder). Should I need to do anything more than that? Does it matter what folder I upload my custom aspx pages to? Do I only need the aspx file or do I need anything more than that?

    Thanks
    Paul
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    19 Dec 2009
    Link to this post
    Hi Paul Dench,

    Thank you for getting back to me.

    Since this is in the global name space, just try adding the assembly name. You should be specifying assembly names as the classes are not part of the code file of the page, but exist in a compiled assembly.

    Greetings,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Paul Dench
    Paul Dench avatar
    19 posts
    Registered:
    26 Oct 2009
    28 Dec 2009
    Link to this post
    Hi,

    So what I've done now is remove all references to external pages, and I am back to where I started, with everything working fine. Once I add the "GLAdvisor_deploy.dll" file to the bin folder, I get the error message in the attached screen shot.

    My 2 master pages both rely on this DLL for functionality, as well as the custom external pages I'm trying to add here. Any thoughts on what I'm missing here?

    Thanks again
    Paul
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    29 Dec 2009
    Link to this post
    Hi Paul Dench,

    Thank you for getting back to me.

    To be honest this does not seem like an error related to Sitefinity only. I think that you will get this kind of error in a regular ASP.NET web site on which you have added this .dll and which ASP.NET site has the Global.asax file in its root directory. A Sitefinity website contains this file by default. And during compilation of you get the error because you cannot have more than one Global.asax file in one application.

    You can either re-factor your code in the .dll so that the logic from the Global.asax file there is moved to the one in your Sitefinity website, so both files do not conflict at compilation of the website. If you do not have any code in Global.asax in GLAdvisor_deploy project you can remove it as this file is optional. Or rebuild your GLAdvisor_deploy project so that it has its own bin directory so its asax file is compiled into it. You should also clean the Temporary ASP.NET files folder.

    Kind regards,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Paul Dench
    Paul Dench avatar
    19 posts
    Registered:
    26 Oct 2009
    29 Dec 2009
    Link to this post
    Hi,

    We have "massaged" our Global.asax file and now we are working fine. Thanks for your help!

    Paul
Register for webinar
7 posts, 0 answered