SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a site with anonymous access and forms based authentication. Now I want to show the link to create a new user in the master page when ever no one is signed in. Can any one please help to achieve this process? Following are the screen shots for more details. enter image description here enter image description here

share|improve this question
up vote 1 down vote accepted

You could add a delegate control and user control to check to your master page, and check if the user is anonymous then show the link :)

Add a Delegate control to your master page:

   <SharePoint:DelegateControl runat="server" ControlId="PageHeader">

Only thing to note here at this stage is the ControlId attribute - the Feature we create will use this to substitute the real user/server control.

Then we have the feature.xml file, where we specify the feature details (including scope):

<Feature xmlns="" Id="373042ED-718D-46e2-9596-50379DA4D522"
Description="Specifies which user control should be used for the 'PageHeader' DelegateControl used on the site master page. The replacement user control is stored in the CONTROLTEMPLATES directory." Scope="Farm"
<ElementManifest Location="elements.xml"/>

the 'instructions' for the feature are in the element manifest:

<Elements xmlns="">
<!-- using a sequence number LOWER than default of 100 so our custom control gets loaded -->
<Control Id="PageHeader" Sequence="90" ControlSrc="~/_ControlTemplates/COBPageHeader.ascx" />

In the COBPageHeader.ascx code-behind, add the logic of hiding link.

share|improve this answer
For anonymous we have to show the link to register... :) – Mihir Nov 9 '12 at 11:32
ok, whatever ;), but hopefully you will develop it :) – Falak Mahmood Nov 9 '12 at 12:02
Here Instead of that feature.xml and element.xml we can do one thing. Just add an empty element and refer the control id and other parameters. Just change the scope of the feature in feature editor scree. Thats it.! this way works successfully!! Thank you brother – Mihir Nov 9 '12 at 12:10

You can check if the CurrentUser has a LoginName which is not an empty string attached to the SPContext.Current.User object. If the LoginName is null or empty, then the user is anonymous.

Code here:

You can write the code in a delegate control which will be attached to the Master Page. The Delegate Control will check If the user is anonymous, and if yes, push the link to the page.

share|improve this answer
thank you.. But where I want to add that user checking code in master page? – Mihir Nov 9 '12 at 10:21
Just search for how to add a delegate control to a page – Vardhaman Deshpande Nov 9 '12 at 11:48

I have recently made use of this feature, made use of a delegate control to accomplish this

share|improve this answer
Welcome to SharePoint StackExchange. Although your answer may answer the question, there isn't enough content to produce a suitable working solution. Please read the FAQ[1] for more information [1] – Hugh Wood Dec 2 '12 at 3:24

Your Answer


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.