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
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
I use the workaround which covers _layouts cases
/// <summary>
/// Builds real URL considering layouts pages.
/// </summary>
private Uri CurrentUrl
{
get
{
return Request.Url.ToString().ToLower().Contains("_layouts")
? new Uri(
SPContext.Current.Site.WebApplication.GetResponseUri(
SPContext.Current.Site.Zone).ToString().TrimEnd('/')
+ Request.RawUrl)
: Request.Url;
}
}