473,473 Members | 1,807 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Use System.Reflection to get page namespace

How can I use Reflection to get full namespace of my web page?

I got a page under this namespace

namespace CompanyABC.Admin
{
public class FruitList: System.Web.UI.Page
{
}
}

Q1: When i try to use this.GetType().ToString, it returns
ASP.FruitList_aspx. but I want to get CompanyABC.Admin.FruitList.(When i
watch the object Page in the watch window, I can see
CompanyABC.Admin.FruitList under the [ASP.FruitList_aspx] tree node.) How
can I do that?

Q2: How to truncate CompanyABC so that I can get Admin.FruitList only?


Nov 19 '05 #1
3 3279
Hello Joel,

You could try this.GetType().Namespace...

--
Matt Berther
http://www.mattberther.com
How can I use Reflection to get full namespace of my web page?

I got a page under this namespace

namespace CompanyABC.Admin
{
public class FruitList: System.Web.UI.Page
{
}
}
Q1: When i try to use this.GetType().ToString, it returns
ASP.FruitList_aspx. but I want to get CompanyABC.Admin.FruitList.(When
i watch the object Page in the watch window, I can see
CompanyABC.Admin.FruitList under the [ASP.FruitList_aspx] tree node.)
How can I do that?

Q2: How to truncate CompanyABC so that I can get Admin.FruitList only?


Nov 19 '05 #2
Page.GetType().BaseType.ToSTring();
"Matt Berther" <mb******@hotmail.com> wrote in message
news:22***************************@news.microsoft. com...
Hello Joel,

You could try this.GetType().Namespace...

--
Matt Berther
http://www.mattberther.com
How can I use Reflection to get full namespace of my web page?

I got a page under this namespace

namespace CompanyABC.Admin
{
public class FruitList: System.Web.UI.Page
{
}
}
Q1: When i try to use this.GetType().ToString, it returns
ASP.FruitList_aspx. but I want to get CompanyABC.Admin.FruitList.(When
i watch the object Page in the watch window, I can see
CompanyABC.Admin.FruitList under the [ASP.FruitList_aspx] tree node.)
How can I do that?

Q2: How to truncate CompanyABC so that I can get Admin.FruitList only?


Nov 19 '05 #3
HI Joel

Type t = typeof(FruitList);
t.FullName.ToString();

will you give full name of the class including namespace.

Do remember to include

using System.Reflection;

cheers,

Jerome. M

"Joel Leong" wrote:
How can I use Reflection to get full namespace of my web page?

I got a page under this namespace

namespace CompanyABC.Admin
{
public class FruitList: System.Web.UI.Page
{
}
}

Q1: When i try to use this.GetType().ToString, it returns
ASP.FruitList_aspx. but I want to get CompanyABC.Admin.FruitList.(When i
watch the object Page in the watch window, I can see
CompanyABC.Admin.FruitList under the [ASP.FruitList_aspx] tree node.) How
can I do that?

Q2: How to truncate CompanyABC so that I can get Admin.FruitList only?


Nov 19 '05 #4

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

Similar topics

0
by: Pat Ireland | last post by:
To use the InvokeMember for calling a method in a dynamically loaded class requires that any arguments to the method must be past in an object . However, when I try to perform a pass by reference...
1
by: Justice Gray | last post by:
I have the following code encapsulated in an ascx page (user control): namespace MyCompany.Web.UserControls { string webform_namespace = this.GetType().Namespace.ToString(); } Now, when I...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
1
by: Mongo | last post by:
I am getting the following error when I try to run a new webservice I have placed on any one of 4 windows 2003 servers. (Running under ASP.NET 1.1) To minimize the problem, I created a simple...
3
by: groovyjman21 | last post by:
Hi, I am using FXCop on my c# project and it is complaining about signing the assembly with a strong name key. All the documentation I can find says to do: using System.Reflection; .... ...
11
by: Ed Bitzer | last post by:
I have been able using the namespace System.Web.Mail and its method Smtp.mail.send to mail simple text messages to a small group within our 55 and older community. I need help expanding the...
1
by: John Wright | last post by:
I have going to develop a new program from scratch using VB 2008. During our discussion with the clients, it became clear very early that we will need to supply additional functionality for...
9
by: Michael Sander | last post by:
Hello ng, anyone knowns how to add a reference to an assembly to System.Reflection.AssemblyBuilder? In System.Web.Compilation.AssemblyBuilder is a function like AddAssemblyReference, but not in...
4
by: JamTech | last post by:
The Script Resource and the Web Resource files are generating intermittent errors in my application. I have been trying to chase the cause of the problem but to no avail. I notice that the “d”...
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.