tags:

views:

2354

answers:

3

In SharePoint how do you get the url of the page you are on from the code behind? e.g. with the blah.aspx page included...

SPContext.Current.Web.Url gives http://vm/en/

I need it with http://vm/en/Pages/blah.aspx

+4  A: 

Try: SPContext.Current.File.Url

You could also use HttpContext.Current.Request.Url

Alex Angas
+3  A: 

You can still get the HTTPContext and then use HTTPContext.Current.Request.Url

SPContext.Current.Web is the SPWeb surrounding the page you're on, and thus its URL is the URL of the Web, not the page.

Yuliy
A: 

Try : SPContext.Current.Web.Url +"/"+ SPContext.Current.File.Url

Dinh Gia Khanh