How to create a custom welcome menu SharePoint 2010

This SharePoint 2010 tutorial, we will discuss how to create a custom welcome menu SharePoint 2010.

A few days back I had one requirement where I do not need to show My Site link as well as I want to redirect My Profile link to a different page in the welcome link in SharePoint 2010. Though I am able to add one more link to the welcome menu, I was not able to find a good article about how to remove My profile link.

So what we have decided to do it is: we will go for a custom welcome link where we can have the name, my profile link that will go to a different page, Sign out and Sing in as different user link.

Here is an article on how to create a visual web part in SharePoint 2010.

After that here is the .aspx code:

Welcome, <asp:PlaceHolder ID="placeHolderWelcomeName" runat="server"></asp:PlaceHolder>
<asp:HyperLink ID="hylnkMyProfile" runat="server" NavigateUrl= “~/_layouts/SharePointUserNameTest/mycustompage.aspx">My Profile</asp:HyperLink><br />
<asp:HyperLink ID="hylnkSignInDifferentUser" runat="server" NavigateUrl="<%$SPurl:~SiteCollection/_layouts/closeConnection.aspx?loginasanotheruser=true%>">Sign in as a Different User</asp:HyperLink><br />
<asp:HyperLink ID="hylnkSignOut" runat="server" NavigateUrl="<%$SPurl:~SiteCollection/_layouts/signout.aspx%>">Sign Out</asp:HyperLink>

And the .cs code:

protected void Page_PreRender(object sender, EventArgs e)
{
//Get the name
PostCacheSubstitutionText welcomeText = new PostCacheSubstitutionText();
welcomeText.TextType = PostCacheSubstitutionTextType.UserName;
placeHolderWelcomeName.Controls.Add(welcomeText);
}

Here in the above code we are getting the user name by the code.

As also you can see My Profile link is pointing to a different custom application page rather than to the existing My Profile page.

The 3rd hyperlink is the Sign in as a Different User link, You just need to call closeConnection.aspx page with a query string parameter as loginasanotheruser=true.

The 4th link is for Sign out which is responsible for sign out and here we are calling the default SharePoint signout.aspx page.

You may like following SharePoint 2010 tutorials:

I hope this SharePoint tutorial helps to learn how to create a custom welcome menu in SharePoint 2010 using the SharePoint visual web part and SharePoint server object model.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SPGuides.com

>