The referenced file [UserControlFile] is not allowed on this page

3

Friday, September 26, 2008 by Nandu

A friend of mine placed the user controls in the /usercontrols folder of the virtual directory and added the user control reference in the default.master. When he tried to see the page in browser he got the follwing error:

The referenced file ‘/usercontrols/someusercontrol.ascx’ is not allowed on this page.

When the same usercontrol was placed in the _Controltemplates folder of the 12 hive, things worked.

We went through the we.config and found that _controltemplates folder entry was made in the <SafeControls> section.

We added an entry for the usercontrols folder and things worked fine.

3 thoughts on “The referenced file [UserControlFile] is not allowed on this page

  1. Mobin Mohammed says:

    Thanks

    That worked a treat.

  2. Bob says:

    Just to let you know, you just clarified an important point. People on other blogs are giving wrong directions on how to add a simple user control to Share Point. Yours is just to the point. registering the control to GAC or creating the class outside SharePoint designer and add the DLL to the BIN folder are really not neccessary.

  3. Rebanene says:

    Thank you!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: