Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bob 38 posts 160 karma points
    Mar 15, 2017 @ 14:03
    Bob
    0

    Error loading control

    I have a web application project and created two folders, Controls and SiteControls, inside Controls I have another folder called Reusable which has a web user control called Main.

    I’m trying to load the control Main from another web user control which is inside the SiteControls folder using the below code

    LoadControl = Page.LoadControl("~/Controls/Reusable/Main.ascx");

    But no matter what I try I always get the error that the control could not be found? How could I resolve this?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Mar 15, 2017 @ 14:05
    Alex Skrypnyk
    1

    Hi Bob

    Can you check permissions for your folders?

    Maybe IIS process hasn't access to this folder.

    Thanks,

    Alex

  • Bob 38 posts 160 karma points
    Mar 15, 2017 @ 14:19
    Bob
    0

    Hi I'm running this locally. The error suggests that it can't find the control so I thought I must have the wrong path?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Mar 15, 2017 @ 14:20
    Alex Skrypnyk
    1

    Hi Bob

    If your path is right, but process which is running hasn't access to folder you will get this error, so I would check access first.

    Are you running site via visual studio?

  • Bob 38 posts 160 karma points
    Mar 15, 2017 @ 14:45
    Bob
    0

    Hi, not a permission issue as I have now added everyone to the parent folder with all controls. Yes I'm using VS and I place the control on a page along with the dll in the bin directory and the error shows. Is there anyway I can check to see what path it's looking at? Thx

  • Bob 38 posts 160 karma points
    Mar 15, 2017 @ 15:04
    Bob
    100

    Ok the problem was the path needs to be the same as if the directory your looking at is the on your site. Since my project was separate to the site I changed the path to usercontrols\ which resolved.

    Thanks Alex for trying

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Mar 15, 2017 @ 15:05
    Alex Skrypnyk
    0

    You are welcome, Bob.

    Glad that you find out what is the issue.

    Have a nice evening!

    /Alex

Please Sign in or register to post replies

Write your reply to:

Draft