Pregunta

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?

¿Fue útil?

Solución

Try

SPContext.Current.Site.RootWeb.RootFolder.WelcomePage

Otros consejos

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

SPWeb parentWeb=SPContext.Current.Site.RootWeb;
string strFullHomePageUrl= parentWeb.Url+ "/"+ parentWeb.RootFolder.WelcomePage;

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
Licenciado bajo: CC-BY-SA con atribución
scroll top