ASP.NET – How to get current webpage name.

Posted by Joggee | ASp.NET 2005 | Wednesday 26 September 2007 8:32 pm

Here is the single line of code for getting current webpage name.

Dim pag As String = System.IO.Path.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath())

5 Comments »

  1. Comment by ahmed gbadamosi — January 9, 2009 @ 10:41 am

    just came across this page. but not tried it yet.
    i suppose it should work. thanks anyway man

  2. Comment by Abhishek — February 1, 2009 @ 11:04 am

    how to add a file on our webpage from system and then make it available for downloading by user just like we download music,softwares form any website??
    is there any code for it??

  3. Comment by Ako — March 19, 2009 @ 11:06 am

    good idea. thanks a lot.

  4. Comment by sangam uprety — March 27, 2009 @ 1:32 pm

    Thanks for the tips-short but useful.
    I guess Request.Url.AbsolutePath() should alone do the task. Just guess..not sure.

    Regards,
    Sangam Uprety

  5. Comment by R Singh — May 12, 2009 @ 8:25 am

    giving error Object reference not set to an instance of an object. set with new keyword

RSS feed for comments on this post. TrackBack URI

Leave a comment