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 need to get the current absolute url of my site from inside code-behind. I tried SPContext.Current.Site.Url and get this error Value does not fall within the expected range.

The goal is to get this url: "" as result.

share|improve this question
up vote 2 down vote accepted

Absolute : SPContext.Current.Web.Url


BTw there is simlar question already asked @ how to get current URL in SharePoint?

share|improve this answer

You can use System.Web.HttpContext.Current.Request.Url to get the full url which includes the page.

share|improve this answer

i able to fix by doing:

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.