Question: Plase guide me how to get URL path **excluding** page name on localhost and server.

for example for the page Active.aspx local path that I want to get is here in bold.

\***http://localhost:1532/WebFolder/**\*Active.aspx

and on server I want to get this bold part

\****http://domain.com/WebFolder/***\*Active.aspx

Similarly if page is in root it will return

\****http://domain.com/****Active.aspx or* \*http://localhost:1532/\*\*Active.aspx

Answer: 
If you just want to get the local file path of a page, eg. "Active.aspx"
Use

```
Request.AppRelativeCurrentExecutionFilePath

```

which ignores your localhost, local host file mapping, or virtual directory name and will return "**~/Active.aspx**"
Other properties such as Request.Url.LocalPath won't help.
try this:

```
Server.MapPath("~/");
       or 
Request.Url.Host

```