474,007 Members | 38,979 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get ASPX page's class Type by its path.

Hi all,

Given a virtual path (URL) to a page, I need to programmaticall y get its
class type.
For example, there is a page /MyAspNetApp/TargetPage.aspx .
I need to get the automatically generated class to check its type, e.g. to
check if the class implements a certain interface. The base class
(codebehind) will do as well.

I see there is a System.Web.UI.P ageParser.GetCo mpiledInstance( ) method but
unfortunatelly I can't use it in my scenario. Basically I don't want to
create an instance, just get the compiled type.

There is also, System.Web.UI.P ageParser.GetCo mpiledType(), which looks like
exactly what I need, but this method is marked as internal.

Is there anything I could do?

Thanks,
-Oleg.
Nov 18 '05 #1
1 1733
the problem you will have is until the page has been compiled, the
information does not exists. when a page is hit, it will be compiled and the
dll placed in a temp dir. at this point the page dll is loaded into the
current appdomain, and you could use reflection to find it (though the name
gets munged), unless it gets recompiled, in which case you will find two
copies.

if you have good naming convetion, you can load the codebehind assembly and
use reflection to fint the code-behind class, then check for the interface.
if code needing to the lookup is in the codebehind then its really simple.

-- bruce (sqlwork.com)
"Oleg Ogurok" <ol**@ogurok.co m.ihatespammers .ireallydo.co> wrote in message
news:10******** *****@corp.supe rnews.com...
| Hi all,
|
| Given a virtual path (URL) to a page, I need to programmaticall y get its
| class type.
| For example, there is a page /MyAspNetApp/TargetPage.aspx .
| I need to get the automatically generated class to check its type, e.g. to
| check if the class implements a certain interface. The base class
| (codebehind) will do as well.
|
| I see there is a System.Web.UI.P ageParser.GetCo mpiledInstance( ) method but
| unfortunatelly I can't use it in my scenario. Basically I don't want to
| create an instance, just get the compiled type.
|
| There is also, System.Web.UI.P ageParser.GetCo mpiledType(), which looks
like
| exactly what I need, but this method is marked as internal.
|
| Is there anything I could do?
|
| Thanks,
| -Oleg.
|
|
Nov 19 '05 #2

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

Similar topics

0
2308
by: Santa | last post by:
I am using Fritz Onion's "Asynchronous Pages" approach as mentioned in the article http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/default.aspx to increase the performance of my ASPX page.I am using the Custom thread pool as given in the article's sample. Implementation: =============== In AsyncPage.aspx I inhereted AsyncPage class instead of System.Web.UI.Page. SyncPage.aspx is like any other Web page which inherits
1
2821
by: Jerry Tovar | last post by:
I am using .Net 2003 on a XPPro running IIS. I am unable to view any of my ASPX webforms in a browser unless I modify the .ASPX file and replace Codebehind="employee.aspx.cs" with src="employee.aspx.cs". It looks like my bin/employee.dll file is not being used. Instead, my employee.aspx.cs file is being used.
3
3262
by: sumit | last post by:
Hi, I am having an asp.net application installed on client's development server. Previously, When i was hitting the url to access the aspx page it was working fine and css was also getting accessed by the application. Suddenly, For that aspx page, css settings are not getting highlited. I changed the css file as well but still i am getting that problem,,, I dont have any IIS access of that dev. server.
8
6920
by: A.M | last post by:
Hi, I know that i can use Page.Request.Path to find what is the current page name. The problem is I can't access to Page object inside a user control. Is there any way that a user control access to the page class? Thanks Ali
2
3067
by: moondaddy | last post by:
I'm using vb.net and have an aspx page where I want to call a function in the code behind to do something on the backend and I want to call this function from a jscript function in the aspx page. Furthermore I know there will be a postback involved but the state of the page will not change at all so I would like it to be as efficient as possible with no appearance to the user that anything happened. I saw in someone else's code where...
9
2990
by: JohnSmith | last post by:
I suspect this is easy, but I have been stumped for a day trying to solve this.. I want to be able to have an unlimited number of aspx pages that all use the code in one class file. I want code in that class file to be able to read and write the controls on the aspx pages. For example, on all the aspx pages, I'll have a label named label1. From code in the class file, I want to be able to do something like label1.text = "hello world I...
0
1004
by: ABN | last post by:
Hi I have prepared a new setup of my web application on a machine having Framework 1.0 with SP2 When I am trying to access any of the .aspx page, following exception gets raised Exception Details: System.Web.HttpException: An error occurred while try to load the string resources (GetModuleHandle failed with error 126) Stack trace args, CultureInfo culture, Object activationAttributes) +27 System.Activator.CreateInstance(Type type,...
7
5148
by: Nilesh | last post by:
I am using background-image attribute in a CSS file and linking the CSS file to aspx page. But strangly, background-image attribute is not working for relative URL. e.g. If I apply following css ..navbar-background { background-image: url(images/menubar.gif); } the image is not appearing on the page. It seems that IE is picking
3
3959
by: Pierre | last post by:
Hello, In an aspx page (mypage.aspx) from a web projet, I would like to get the value of a variable of the projet that is declared as public in a module. The variable can be called from anywhere in the code behind page and in the class files, but when I try to call it from an aspx page, it raises an error. <%=myvar%> in mypage.aspx raise an error : the name "myvar" is not declared.
0
10264
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11984
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11521
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
11030
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6554
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6709
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5295
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 we have to send another system
3
3887
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.