Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a problem when adding a user control to my SharePoint 2013 master page: my site shows a 404 error.

At this point I have a brand new, empty user control (i.e. created in VS2012 but nothing added other than the content added by default). I'm adding this to my master page as follows:

<?xml version="1.0" encoding="utf-8"?><!--SPG:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=10" xmlns="" />
    <!--CS: Start Page Head Contents Snippet-->
    <!--SPM:<%@Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
    <!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
    <!--SPM:<%@Register TagPrefix="qmws" TagName="languageSelector" Src="/_controltemplates/langSelector.ascx" %>-->
    <!--SID:00 -->
    <meta name="GENERATOR" content="Microsoft SharePoint" xmlns="" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" xmlns="" />

The third <!--SPM:@Register TagPrefix="qmws"... line is my usercontrol.

  • I have verified that the usercontrol is in the ~/_controltemplates folder.
  • I have tried selecting a different out-of-the-box usercontrol from that location (e.g. leftNavigation.ascx) and my pages loads just fine.
  • I have tried removing lines from my .ascx page, to match LeftNavigation.ascx, but I still get the 404.
  • If I remove that @Register line my page loads correctly.

I'm not sure why this empty usercontrol would cause a problem.

Any ideas?

Thanks

Kevin

share|improve this question
1  
In your submitted code you dont have the ~ in Src="/_controltemplates/langSelector.ascx". Is this a type error here or also in your code? –  Daniel Ziga May 15 '13 at 16:46
    
Both, kinda - but adding that doesn't fix the issue. Thanks for spotting it though –  QMKevin May 15 '13 at 16:49
add comment

1 Answer

up vote 0 down vote accepted

For 2013, to reference the virtual directories you must add /15 after the "_controltemplates" in this case. Like this:

/_controltemplates/15/langSelector.ascx

share|improve this answer
    
Unfortunately that didn't work either. Here is my new line <!--SPM:<%@Register TagPrefix="qmws" TagName="languageSelector" Src="~/_controltemplates/15/langSelector.ascx" %>--> - still gives the 404 error –  QMKevin May 15 '13 at 16:50
    
Interestingly, this does work (again, using an ootb usercontrol, not my own): <!--SPM:<%@Register TagPrefix="qmws" TagName="langSelector" Src="/_controltemplates/LeftNavigation.ascx" %>--> - i.e. without the /15 you mentioned, and the ~/ mentioned by Daniel in his comment –  QMKevin May 15 '13 at 16:53
    
@QMKevin That works because SP2013 also installs the SP2010 folders to ensure SP2010=>SP2013 upgrades doesn't ruin the upgraded websites. –  Daniel Ziga May 15 '13 at 16:55
    
hehe I just got there! I realized I was looking in the /14 folder when locating my usercontrol, not the /15. Copying the usercontrol to /15/_controltemplates fixed the issue. Now I need to work out how to get my 'migrated' VS2010 solution to publish to /15 instead of /14, and I'm all set. Thanks both for the help. Credit goes to Robert for pointing me in the direction of /15. –  QMKevin May 15 '13 at 16:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.