473,386 Members | 1,962 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,386 software developers and data experts.

Get aspx File Name

I need to determine, at runtime, the page name of the currently requested
aspx page.
Page.ToString(), returns sumething like "ASP.MyFile_aspx". What I'd prefer
is to get the actual file name "MyFile.aspx".

Any suggestions?

Thanks.
Nov 18 '05 #1
3 2749
"Jeff" wrote ...
I need to determine, at runtime, the page name of the currently requested
aspx page.
Page.ToString(), returns sumething like "ASP.MyFile_aspx". What I'd prefer
is to get the actual file name "MyFile.aspx".


In vanilla ASP you could have used, Request.ServerVariables("SCRIPT_NAME") -
but I'm sure someone here will have a better way to resolve it in .net :o)

Regards

Rob
Nov 18 '05 #2
why not use page.Request.Path
-----Original Message-----
I need to determine, at runtime, the page name of the currently requestedaspx page.
Page.ToString(), returns sumething like "ASP.MyFile_aspx". What I'd preferis to get the actual file name "MyFile.aspx".

Any suggestions?

Thanks.
.

Nov 18 '05 #3
Here's what I've been using:

public static string PageName()

{

string strTemp;

int intPos;

strTemp =
System.Web.HttpContext.Current.Request.ServerVaria bles["SCRIPT_NAME"].ToStri
ng();

intPos = strTemp.LastIndexOf("/");

strTemp = strTemp.Substring(intPos + 1);

return strTemp;

}

"Jeff" <A@B.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I need to determine, at runtime, the page name of the currently requested
aspx page.
Page.ToString(), returns sumething like "ASP.MyFile_aspx". What I'd prefer
is to get the actual file name "MyFile.aspx".

Any suggestions?

Thanks.

Nov 18 '05 #4

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

Similar topics

2
by: EMW | last post by:
Hi, I use the following to start my ASPX: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>index</title> <meta name="vs_defaultClientScript"...
7
by: Chuck Bowling | last post by:
I'm doing something wrong... not quite sure what... I got a basic web forms page built and running inside the IDE per ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcon/html/vbwlkWalkthroughCr...
3
by: Stevie_mac | last post by:
It might be me but... I dont seem to get a Page_Load event when a opening an ASPX in an iFrame. I do geta Page_Load event when an item on the ASPX (inside the iFrame) is clicked but then...
7
by: Holger (David) Wagner | last post by:
Hi Group, I've searched the Web for precompilers that compile ASPX/ASCX pages just like it can be done with JSPs, but so far, I've only found approaches targetted at increasing the performance....
2
by: Ryan Taylor | last post by:
Hello. I am trying to upload a file and save it in a Sql Server 2000 database. This seems to be working fine. However, when I download the file from SQL Server, it appears that the page that is...
29
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
10
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
2
by: mharness | last post by:
Hello, I've tried a number of examples showing how to read the properties of a user control from an aspx file where the code is on the html view of the form but I can't figure out how to read...
1
by: theintrepidfox | last post by:
Dear Group Just wonder if someone can point me in the right direction please? I have a label control and want to assign a string in a resource. I'm sure I'm on the right track but it doesn't...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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,...

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.