1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / c# and vb.net in App_code

c# and vb.net in App_code

5 posts, 0 answered
  1. Rabindra
    Rabindra avatar
    106 posts
    Registered:
    17 May 2009
    13 Mar 2010
    Link to this post
    Hi,
    I wanted to have both c# and vb.net code in App_code so I created 2 folders CSCode and VBCode. I already had few cs class files in App_code so I moved them to CSCode folder.
    In web.config file I changed
    <add name="Sorted List" section="Custom controls" type="CustomLists, App_Code" description="Sorted List"/>
    to
    <add name="Sorted List" section="Custom controls" type="CustomLists, App_SubCode_CSCode" description="Sorted List"/>

    I don't get error while compiling but when I view my custom control I get this error.
    Could not find a type for a name. The type name was 'CustomLists, App_Code.sykwvap6, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

    Any suggestions?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    14 Mar 2010
    Link to this post
    Hello Rabindra,

    The compilation folder remains App_Code no matter that you have placed the code in a sub folder of App_Code. So, the type should remain type="CustomLists, App_Code". The error you are getting is because the application cannot find dll called App_SubCode_CSCod and namespace CustomLists

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Rabindra
    Rabindra avatar
    106 posts
    Registered:
    17 May 2009
    15 Mar 2010
    Link to this post
    Hi Ivan,
    Ok, I changed App_SubCode_CSCode back to App_code and compiles with no errors. But when I view the page I still get the same error. And if I move the class file to App_Code/Sortedlists.cs I don't get the error.
    Does this work at your test environment?
  4. Rabindra
    Rabindra avatar
    106 posts
    Registered:
    17 May 2009
    15 Mar 2010
    Link to this post
    Hi Ivan,
    I did few testing but not sure if this will work at your end. For me it did.
    I have to change the type to "type="CustomLists, App_SubCode_CSCode". If I leave it as . If I leave it as "type="CustomLists, App_Code" I get error in user control section.
    And if I had already used this control in a page then I will get error when viewing the page. I have to go to edit mode of the page, delete the control and add it again. Doing this worked for me.
    Could you please try at your end? thanks
  5. Rabindra
    Rabindra avatar
    106 posts
    Registered:
    17 May 2009
    21 Apr 2010
    Link to this post
    Ok, I didn't fully test it before so please ignore my previous posts.
    I am still having problem. Here is what I did so far.

    If I don't change App_Code I get an error on "Select a control" section. Pls see image1. I can't do anything.
    <add name="Sorted List" section="Custom controls" type="CustomLists, App_Code" description="Sorted List"/>


    But if I change App_code to App_SubCode_CSCode, I don't get an error under "Select a control". Pls see image2.
    <add name="Sorted List" section="Custom controls" type="CustomLists, App_SubCode_CSCode" description="Sorted List"/>
    So, I can drag and drop the control to the page and change settings. I can save the page and publish it. It works fine.
    But if I rebuild the website I get an error.

    Could not load file or assembly 'App_SubCode_CSCode.1fwr_i1l, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    Can you please help?
Register for webinar
5 posts, 0 answered