How do I find out the page name in ASP

C

Charts

I know it’s trivial but I need it quickly. How do I find out the page name
in ASP, which I am currently using? I did that before but I cannot
remember. I remembered it’s in Server or Application object collection, but
could not find out. Thanks for help.
Charts
 
T

theath

I do it this way:

<code>
Dim pn As String = Me.Page.ToString()
pn = pn.Substring(4, pn.IndexOf("_aspx") - 4)
</code>
 
A

Andrew Backer

What name do you want? The page's class? the actual *physical* page
that was called, the currently executing page (after a server.transfer,
etc), after a path remapping ? :)

Since you mention server variables, I think the var is "script_name",
ie :

Request.ServerVariables["SCRIPT_NAME"]...

FYI, I would just turn on trace, ok, and at the bottom you will see the
entire serverVariables collection output. Just check that for the
variable you need, then call it like above :)

- Andrew
 
C

Charts

Andrew,
Request.ServerVariables["SCRIPT_NAME"] is exactly what I wanted. Thanks so
much. Charts
 

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

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top