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: "http://myspweb.com/mypage.aspx" as result.


Absolute : SPContext.Current.Web.Url


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


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


i able to fix by doing:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.