The ASPX name

  • Thread starter Thread starter A.M
  • Start date Start date
A

A.M

Hi,

Inside an .aspx code, what would be the reliable way to know what is the
..aspx page file name on IIS?

Thanks,
Ali
 
Inside an .aspx code, what would be the reliable way to know what is the
.aspx page file name on IIS?

Request.ServerVariables["SCRIPT_NAME"] would return the base name. You can
combine it with Request.ServerVariables["SERVER_NAME"] and a "http://"
prefix to get the full url.

This is C#, you should replace brackets with parentheses for VB.
 
Here's another:

string myPath = Page.Request.Path;
string pageName = myPath.Substring(myPath.LastIndexOf('/') + 1);

Michael Earls
 
Inside an .aspx code, what would be the reliable way to know what is the
string myPath = Page.Request.Path;
string pageName = myPath.Substring(myPath.LastIndexOf('/') + 1);

That would actually be the pretty way, I gave you the old and ugly way.

Martin.
 
Back
Top