473,408 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Name of Me.Page

I have an ASP.NET applicaiton with a user control and I
need to determine the name of the page it resides on at
runtime. Me.Page returns the page, but how do I get just
the name? CSTR(Me.Page) causes a compile error and there
is no .ToString() on the page class.

Anyone?
Nov 22 '05 #1
6 1838
What do you mean by page's name? Are you referring to the name of the file
as entered in the address bar in the client?

By the way, ALL classes have a ToString method since this method is defined
on the Object class. Not all methods choose to override this method and so
if you call it, the default behavior is just to output the name of the class
the instance if from.
"aLEXb" <an*******@discussions.microsoft.com> wrote in message
news:10****************************@phx.gbl...
I have an ASP.NET applicaiton with a user control and I
need to determine the name of the page it resides on at
runtime. Me.Page returns the page, but how do I get just
the name? CSTR(Me.Page) causes a compile error and there
is no .ToString() on the page class.

Anyone?

Nov 22 '05 #2
What do you mean by page's name? Are you referring to the name of the file
as entered in the address bar in the client?

By the way, ALL classes have a ToString method since this method is defined
on the Object class. Not all methods choose to override this method and so
if you call it, the default behavior is just to output the name of the class
the instance if from.
"aLEXb" <an*******@discussions.microsoft.com> wrote in message
news:10****************************@phx.gbl...
I have an ASP.NET applicaiton with a user control and I
need to determine the name of the page it resides on at
runtime. Me.Page returns the page, but how do I get just
the name? CSTR(Me.Page) causes a compile error and there
is no .ToString() on the page class.

Anyone?

Nov 22 '05 #3
If you ARE looking for just the name of the page as a file, then you
could simply do

Me.Page.Request.ServerVariables("SCRIPT_NAME")

Then just get the substring after the last occurence of "/" (SCRIPT_NAME
includesthe whole path, relative to the web app root).

aLEXb wrote:
I have an ASP.NET applicaiton with a user control and I
need to determine the name of the page it resides on at
runtime. Me.Page returns the page, but how do I get just
the name? CSTR(Me.Page) causes a compile error and there
is no .ToString() on the page class.

Anyone?


Nov 22 '05 #4
If you ARE looking for just the name of the page as a file, then you
could simply do

Me.Page.Request.ServerVariables("SCRIPT_NAME")

Then just get the substring after the last occurence of "/" (SCRIPT_NAME
includesthe whole path, relative to the web app root).

aLEXb wrote:
I have an ASP.NET applicaiton with a user control and I
need to determine the name of the page it resides on at
runtime. Me.Page returns the page, but how do I get just
the name? CSTR(Me.Page) causes a compile error and there
is no .ToString() on the page class.

Anyone?


Nov 22 '05 #5
One other note, just remember to always check before accessing
Request/Response and the like, that

Not IsNothing(Me.Context)

Eidolon wrote:
If you ARE looking for just the name of the page as a file, then you
could simply do

Me.Page.Request.ServerVariables("SCRIPT_NAME")

Then just get the substring after the last occurence of "/" (SCRIPT_NAME
includesthe whole path, relative to the web app root).

aLEXb wrote:
I have an ASP.NET applicaiton with a user control and I need to
determine the name of the page it resides on at runtime. Me.Page
returns the page, but how do I get just the name? CSTR(Me.Page)
causes a compile error and there is no .ToString() on the page class.

Anyone?



Nov 22 '05 #6
One other note, just remember to always check before accessing
Request/Response and the like, that

Not IsNothing(Me.Context)

Eidolon wrote:
If you ARE looking for just the name of the page as a file, then you
could simply do

Me.Page.Request.ServerVariables("SCRIPT_NAME")

Then just get the substring after the last occurence of "/" (SCRIPT_NAME
includesthe whole path, relative to the web app root).

aLEXb wrote:
I have an ASP.NET applicaiton with a user control and I need to
determine the name of the page it resides on at runtime. Me.Page
returns the page, but how do I get just the name? CSTR(Me.Page)
causes a compile error and there is no .ToString() on the page class.

Anyone?



Nov 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ian Hubling | last post by:
Here's what I'm trying to do: I have a large number of pages that call a pop-up survey page. It is important to know what page the survey is referring to - so I am passing the name of the...
11
by: Andrew Thompson | last post by:
I have written a few scripts to parse the URL arguments and either list them or allow access to the value of any parameter by name. <http://www.physci.org/test/003url/index.html>...
8
by: drillbit_99 | last post by:
I have an HTML page of thumbnail images. Each image can begin a slideshow of the images on the page by clicking on the image. This opens another HTML page that begins the slideshow using large...
2
by: Giovane Calabrese | last post by:
( aspx + vb ) hi everyone ! I really need make that function work ! im brazilian , and i want to make a multilanguage system , that function above must look at all ASPX take the labels ID and...
0
by: Giovane Calabrese | last post by:
ok. im try to make a multilanguage system based on that tutorial : http://www.123aspx.com/redir.aspx?res=29112 in my aspx pages all text are in labels , and i want to take the name labels...
2
by: John Holmes | last post by:
I am using radioButton controls in a data repeater and would like to incorporate the 'key' field into the 'id' attribute of the radioButton controls and name them something like: 'rad' + '<%#...
6
by: ad | last post by:
When I a webpage, say "MyPage.aspx", How to get the page name of itsef (MyPage.aspx)?
24
by: Chameleon | last post by:
This code does not working in Mozilla. Works fine in IE. -------------- <input type=text value=100 name=textbox> <script> alert(textbox); </script> -------------- This perhaps, because of...
2
by: Cindy Lee | last post by:
Sorry I'm new, this must be easy, but how do you add the log in name to the title of the web page? (This is using the Microsoft Personal Web page starter kit), the top of the page is listed below....
4
by: iam247 | last post by:
Hi Can the following 2 things be done in asp.net? I do not need a lot of guidance on how to implement - just can it be done and any anticipated problems. 1. GENERATE PAGE ON THE FLY I am...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.