0

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.

2

Absolute : SPContext.Current.Web.Url

[Edit]

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

1

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

0

i able to fix by doing:

SPContext.Current.ListItemServerRelativeUrl

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.