473,386 Members | 1,694 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 page's class Type by its path.

Hi all,

Given a virtual path (URL) to a page, I need to programmatically 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.PageParser.GetCompiledInstance() 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.PageParser.GetCompiledType(), 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 1711
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.com.ihatespammers.ireallydo.co> wrote in message
news:10*************@corp.supernews.com...
| Hi all,
|
| Given a virtual path (URL) to a page, I need to programmatically 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.PageParser.GetCompiledInstance() 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.PageParser.GetCompiledType(), 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
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...
1
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...
3
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...
8
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...
2
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. ...
9
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...
0
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...
7
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...
3
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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,...

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.