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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top