473,569 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding all Web Forms in a web site using reflection

(This question has been asked previously in this group, but I don't
think it was ever really properly answered.)

I want to use reflection - preferably - to find all Web Forms in my web
site that inherit my base page class (which in turn inherits
System.Web.UI.P age). Behold the following code:

For Each asm As System.Reflecti on.Assembly In
System.AppDomai n.CurrentDomain .GetAssemblies( )
For Each mdl As System.Reflecti on.Module In asm.GetModules( )
For Each typ As System.Type In mdl.GetTypes()
If typ.IsSubclassO f(GetType(MyBas ePage))
..

This code only seems to list Web Forms that have actually been run. Why
is that? Even pages within the same assembly don't show up until they
have been run. Also, this behaviour is the same in the ASP.NET
Development Server and a web site published with the ASP.NET compiler
running in IIS.

Is there another, better, way to find a list of all Web Forms in a web
site?

I want to avoid having to inspect all DLL files in ~/bin/...

Dec 14 '06 #1
4 2186
Are you using the typical ASP.Net Web Site project, or are you using the
add-on Web Application project. I don't think the Web Site project forms are
truly getting pre-compiled in the same fashion that the Web Application
project or the old VS 2003 web projects did. You might experiment by
creating an app with the new web application project download over at
www.asp.net and see if there is a difference. I stopped using the web site
project for similar compilation issues.
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006


"Per Bolmstedt" <to****@gmail.c omwrote in message
news:11******** *************@f 1g2000cwa.googl egroups.com...
(This question has been asked previously in this group, but I don't
think it was ever really properly answered.)

I want to use reflection - preferably - to find all Web Forms in my web
site that inherit my base page class (which in turn inherits
System.Web.UI.P age). Behold the following code:

For Each asm As System.Reflecti on.Assembly In
System.AppDomai n.CurrentDomain .GetAssemblies( )
For Each mdl As System.Reflecti on.Module In asm.GetModules( )
For Each typ As System.Type In mdl.GetTypes()
If typ.IsSubclassO f(GetType(MyBas ePage))
..

This code only seems to list Web Forms that have actually been run. Why
is that? Even pages within the same assembly don't show up until they
have been run. Also, this behaviour is the same in the ASP.NET
Development Server and a web site published with the ASP.NET compiler
running in IIS.

Is there another, better, way to find a list of all Web Forms in a web
site?

I want to avoid having to inspect all DLL files in ~/bin/...

Dec 14 '06 #2

It's a normal "ASP.NET Web Site" created with VS2005.

I don't think precompilation is the issue since the behaviour exhibits
on a "published" web site as well.

The merge tool in the WAP template would probably let me reflect the
way I want, but I'd still be interested in explanations of the
behaviour, as well as possible solutions for an ASP.NET Web Site...

On Dec 14, 2:36 pm, "Mark Fitzpatrick" <markf...@fitzm e.comwrote:
Are you using the typical ASP.Net Web Site project, or are you using the
add-on Web Application project. I don't think the Web Site project forms are
truly getting pre-compiled in the same fashion that the Web Application
project or the old VS 2003 web projects did. You might experiment by
creating an app with the new web application project download over atwww.asp.netan d see if there is a difference. I stopped using the web site
project for similar compilation issues.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Per Bolmstedt" <tom...@gmail.c omwrote in messagenews:11* *************** *****@f1g2000cw a.googlegroups. com...
(This question has been asked previously in this group, but I don't
think it was ever really properly answered.)
I want to use reflection - preferably - to find all Web Forms in my web
site that inherit my base page class (which in turn inherits
System.Web.UI.P age). Behold the following code:
For Each asm As System.Reflecti on.Assembly In
System.AppDomai n.CurrentDomain .GetAssemblies( )
For Each mdl As System.Reflecti on.Module In asm.GetModules( )
For Each typ As System.Type In mdl.GetTypes()
If typ.IsSubclassO f(GetType(MyBas ePage))
..
This code only seems to list Web Forms that have actually been run. Why
is that? Even pages within the same assembly don't show up until they
have been run. Also, this behaviour is the same in the ASP.NET
Development Server and a web site published with the ASP.NET compiler
running in IIS.
Is there another, better, way to find a list of all Web Forms in a web
site?
I want to avoid having to inspect all DLL files in ~/bin/...
Dec 14 '06 #3
reflection can only see loaded assemblies. in asp.net each page is a
seperate dll (though using batching can cause some grouping). each page
dll gets loaded the first time its referenced. if the site is not
precompiled, the dll don't even exist until the page is requested
(always true in version 1).

in 1.1 the code-behinds were compiled into one dll (by vs), so
reflection could see the base classes for web pages, but the actual page
class was not available until the actual page dll was loaded.
-- bruce (sqlwork.com)
Per Bolmstedt wrote:
(This question has been asked previously in this group, but I don't
think it was ever really properly answered.)

I want to use reflection - preferably - to find all Web Forms in my web
site that inherit my base page class (which in turn inherits
System.Web.UI.P age). Behold the following code:

For Each asm As System.Reflecti on.Assembly In
System.AppDomai n.CurrentDomain .GetAssemblies( )
For Each mdl As System.Reflecti on.Module In asm.GetModules( )
For Each typ As System.Type In mdl.GetTypes()
If typ.IsSubclassO f(GetType(MyBas ePage))
..

This code only seems to list Web Forms that have actually been run. Why
is that? Even pages within the same assembly don't show up until they
have been run. Also, this behaviour is the same in the ASP.NET
Development Server and a web site published with the ASP.NET compiler
running in IIS.

Is there another, better, way to find a list of all Web Forms in a web
site?

I want to avoid having to inspect all DLL files in ~/bin/...
Dec 14 '06 #4

I'm using ASP.NET 2.0 and the ASP.NET Web Site template, so none of
this applies. Rather, each ASP.NET directory gets compiled into its own
App_Web_??????? ?.dll assembly. But "pages" (classes that inherit a
class that inherits System.Web.UI.P age) in the same assembly don't show
up in the sample reflection code below unless they're explicitly
invoked, which I find odd.

But I guess the WAP template is the only real solution. Can anyone
verify that it does indeed solve my problem?

On Dec 14, 5:21 pm, bruce barker <nos...@nospam. comwrote:
reflection can only see loaded assemblies. in asp.net each page is a
seperate dll (though using batching can cause some grouping). each page
dll gets loaded the first time its referenced. if the site is not
precompiled, the dll don't even exist until the page is requested
(always true in version 1).

in 1.1 the code-behinds were compiled into one dll (by vs), so
reflection could see the base classes for web pages, but the actual page
class was not available until the actual page dll was loaded.

-- bruce (sqlwork.com)

Per Bolmstedt wrote:
(This question has been asked previously in this group, but I don't
think it was ever really properly answered.)
I want to use reflection - preferably - to find all Web Forms in my web
site that inherit my base page class (which in turn inherits
System.Web.UI.P age). Behold the following code:
For Each asm As System.Reflecti on.Assembly In
System.AppDomai n.CurrentDomain .GetAssemblies( )
For Each mdl As System.Reflecti on.Module In asm.GetModules( )
For Each typ As System.Type In mdl.GetTypes()
If typ.IsSubclassO f(GetType(MyBas ePage))
..
This code only seems to list Web Forms that have actually been run. Why
is that? Even pages within the same assembly don't show up until they
have been run. Also, this behaviour is the same in the ASP.NET
Development Server and a web site published with the ASP.NET compiler
running in IIS.
Is there another, better, way to find a list of all Web Forms in a web
site?
I want to avoid having to inspect all DLL files in ~/bin/...
Dec 14 '06 #5

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

Similar topics

3
1237
by: Jaime Lucci | last post by:
Hi, how've you been? I'm trying to do a .dll that would be able to manage forms from an independient project. The dll has a method that receive a parameter which is the form I want to manage. The problem is that I have to pass the instancied form as parameter instead of its name. When I have to manage many forms, it will be necessary to...
3
4361
by: Bisbal | last post by:
Hi, I'd like to know if it is possible to create a form type from a string. My case: I have a DataTable with forms names (i.e frm_001_UserInfo.cs), and I'd like to create an instance of that form from my code dynamically, retrieving the form name from the database. Something like str = "frm_001_UserInfo.cs" and then create an instance of...
6
1221
by: JonS. | last post by:
Hi, I'm trying to create a Windows Forms portal application and need some help. What I currently have is a main application (.exe) containing an MDI form. The idea is that this main application loads forms from packages (i.e. DLLs containing one or more forms). The trick is that I'd like the form packages and forms loaded to be dynamic. ...
0
4208
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET Applications and owner of Access Microsystems. Doug can be reached at doug@accessmicrosystems.com....
6
1082
by: Tor Inge Rislaa | last post by:
Finding name of all forms I want to create a procedure that can loop trough all objects of type form in an application and print the name property to the debug window. TIRislaa
8
7894
by: J.S. | last post by:
I was under the impression that frames could be used in Windows forms in earlier version of VB. However, in VB 2005 Express I don't see any such tool/control. Is SplitContainer used for this purpose in VB 2005? I want to create a frame in a Windows form because I'd like button clicks on the left side of the form to change the form elements...
12
1959
by: Peter Van Wilrijk | last post by:
Hi, In VB6 I have the following code ... Dim frmLink As Form Set frmLink = Forms.Add(stringformname) frmLink.Show 'wait until all data has been loaded Do Until frmLink.Loaded = 21 DoEvent
1
2034
by: gnana | last post by:
Hi, I want to find controls in a ASP.NET page using System.Reflection.Assembly. I have to create an Application to set the Permission(visible/editable) for each control on the page, for this i need to know what are the controls in a asp.NET page. All I have is Assembly (.DLL) and page name. Please help me. Thanks!
7
1688
by: joproulx | last post by:
Hi, I was wondering if there was a way with Reflection to find dynamically if an object was referencing indirectly another object. A simple example would be: Object1 | --Object2 |
0
7628
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...
0
7938
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. ...
0
8145
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...
1
7694
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6317
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5245
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...
0
3667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2128
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
1
1236
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.