473,396 Members | 2,102 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,396 software developers and data experts.

Referring to page name


....still new with vb in visual studio 2005

how can I refer to the name of my .aspx page to use it in code?

E.g., I have a series of .aspx pages and each has a corresponding column in
a database that I wish to access. The column correponsing to each page has
the same name as the page. Rather than type out the column names for each
page individually, I want to do something to automatically refer to the page
name in the code. Something like, me.pagename

Jeff

Nov 14 '07 #1
1 1059
Dim strFileName as string = Request.Url.AbsolutePath.Substring (
Request.Url.AbsolutePath.LastIndexOf("/")+1).ToLower
'strFileName.Substring(0, strFileName.LastIndexOf(".")) 'Use this if you
only need the FileName without the suffix.

There are many ways of achieving the same results

If you need to use this from a Generic class etc, then replace Request with
HttpContext.Current.Request

HTH

Trevor Benedict
MCSD
"Jeff" <no**@nothingX.comwrote in message
news:ei**************@TK2MSFTNGP02.phx.gbl...
>
...still new with vb in visual studio 2005

how can I refer to the name of my .aspx page to use it in code?

E.g., I have a series of .aspx pages and each has a corresponding column
in a database that I wish to access. The column correponsing to each page
has the same name as the page. Rather than type out the column names for
each page individually, I want to do something to automatically refer to
the page name in the code. Something like, me.pagename

Jeff

Nov 14 '07 #2

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

Similar topics

3
by: Jenkins | last post by:
I have a page with frames. The left frame is a list of urls. The main frame is loaded based on the url that was clicked in the left frame. Is there a way for the main frame to tell which url was...
2
by: Mike Brearley | last post by:
I was wondering if there was an easy way to have a form set up so that when the submit button is pressed, it goes to a confirmation page that contains a back button that goes back to the page that...
3
by: George | last post by:
VS.NET 2002\Web\VB I am trying to get the referring URL for one of my pages using this: Request.UrlReferrer.ToString Page 1 has a link to Page 2. I click on the link in Page 1, and go to...
2
by: buran | last post by:
Dear ASP.NET Programmers, I want to store the referring page of an .aspx page so that I can redirect the user back to the referring page if needed. I am using the following code snippet but...
3
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so...
7
by: Peter | last post by:
Hi there, I am using this code to retrieve the current URL: function selfURL() { $s = empty($_SERVER) ? '' : ($_SERVER == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER), "/").$s;...
5
by: Christina | last post by:
I can't seem to find any reference for grabbing the title of the referring page, which I want to use for creating a link. i.e. document.write ("Our thanks to <a href='"+document.referrer+"'>"...
2
by: paladin | last post by:
We have a strange situation where some of the referring URL's are missing from our log files. This is on .NET application on IIS 6.0. Here is what is happening: Page a.aspx has a form that...
4
by: CG | last post by:
Hi I need to implement some low level security that locks a certain page if the user does come from a particular link (which is hosted on another domain). I've considered using HTTP_REFERER...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.