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

When I use SPContext.Current.Site.Url it returns "http://servername"

I need the full homepage URL which is "http://servername/SitePages/Home.aspx"

Does anyone know how to get this programmatically?

share|improve this question
up vote 5 down vote accepted



share|improve this answer

To get full url (absolute), you have to :

SPWeb parentWeb=SPContext.Current.Site.RootWeb;
string strFullHomePageUrl= parentWeb.Url+ "/"+ parentWeb.RootFolder.WelcomePage;
share|improve this answer
You can also use SPUrlUtility to build the URL: SPUrlUtility.CombineUrl(parentWeb.Url, parentWeb.RootFolder.WelcomePage) – Rachel Jul 21 '14 at 8:25

as an addition, in general, if you are inside a page and you want to get full path you always can use:

SPContext.Current.Web.Url + "/" + SPContext.Current.File.Url
share|improve this answer

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.