SharePoint get the full URL of the current page in code behind

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

get current page not full url

Is it possible to save the current page in a variable (not the full url) using php So if my page is I am looking to get /bob in a variable.

How to get Current Page’s Url in using code behind technique?

I want to get Url of the page like abc.aspx. how can i get this using code behind technique. Any idea.?

How to get the current URL from ASP.NET code behind

My application is hosted on different servers, and I want to get the URL of the page on the current server. How can you get this property in code behind?

How can I get the URL of the aspx page from code behind?

How can I get the url of the active aspx page from the code behind so that I can assign it to a string variable? Does it make a difference in what page-lifecycle stage I call this? Thanks

get current page url

On a web app using GAS HtmlService I need to get the url of current page to build a new link within a template. The web app will run in a Google sites page (GAS as gadget) but also standalone I am try

How to safely get full URL of parent directory of current PHP page

I’m using: $domain = $_SERVER[‘HTTP_HOST’]; $path = $_SERVER[‘SCRIPT_NAME’]; $themeurl = $domain . $path; But this of course gives the full URL. Instead I need the full URL minus the current file and

Get URL of ASP.Net Page in code-behind from another page

I am trying to find away to determine a pages url from the page object. It seems you can only get the path of the current context.

ASP.NET – Hyperlink relative path to current URL on ASPX page not in code behind

I tried this one but the href code is not generated <asp:HyperLink ID=hlPrev NavigateUrl=<%# this.Request.Url %> runat=server /> Is there any way to do this on aspx page not in the

get current page from url

I want to write a c# method to retrieve the current page. eg Default6.aspx I know I can do the following: string url = HttpContext.Current.Request.Url.AbsoluteUri; // http://localhost:1302/TESTERS/Def

Get URL of ASP.Net Page in code-behind [duplicate]

This question already has an answer here: How do I get the full url of the page I am on in C# 8 answers I have an ASP.Net page that will be hosted on a couple different servers, and I want to g


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.

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

This should return what you require SPContext.Current.ListItemServerRelativeUrl

 string filename = Path.GetFileName(Request.Path);
string PageTitle=SPContext.Current.File.Title

this code worked for me, for pages under _layouts and also for ‘normal’ pages under the site:

        string thisPageUrl;
        if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("_layouts"))
            thisPageUrl = SPContext.Current.Web.Url + context.Request.Path; //note: cannot rely on Request.Url to be correct !
            thisPageUrl = HttpContext.Current.Request.Url.ToString();

I use the workaround which covers _layouts cases

/// <summary>
/// Builds real URL considering layouts pages.
/// </summary>
private Uri CurrentUrl
        return Request.Url.ToString().ToLower().Contains("_layouts")
            ? new Uri(
                + Request.RawUrl) 
            : Request.Url;