Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7514267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:26:44+00:00 2026-05-30T00:26:44+00:00

I need to find all the classes derived from System.Web.UI.Page which reference another class

  • 0

I need to find all the classes derived from “System.Web.UI.Page” which reference another class derived from Page … and everything I try in NDepend gives me either nothing, or every page.

We recently converted an Asp.Net “site” to a “web application,” and in the process discovered that a lot of the pages had the same class name as classes in our database layer. They’re in a different namespace, but since all the pages are in the same namespace (and now, are in the same assembly), we’re having some problems.

Mostly, this caused compile errors when a page used a data layer class and accessed a member of it, but now that all the pages are in a Web Application (and thus, can see each other), the compiler decided they were referencing the web page class and not the data layer class. We’re concerned that some classes might have slipped past the compile-time crash by perhaps implementing a member with the same name, so we want to find any place where .Net thinks that a web Page (a class which inherits (however distantly) from System.Web.UI.Page) has a reference to another web page.

Obviously this NDepend CQL just returns all the pages:

SELECT TYPES FROM ASSEMBLIES "UI" 
WHERE IsUsing "System.Web.UI.Page"
AND DeriveFrom "System.Web.UI.Page"

Does anyone know if this is possible, or if I can write a rule using FXCop or something else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:26:45+00:00Added an answer on May 30, 2026 at 12:26 am

    I am unaware of any way to do this using CQL, although I’m not enough of a CQL expert to be sure that it’s not possible. On the other hand, it is quite feasible to find such problems using FxCop. The following rule code should find your problems, although it’s really only suitable for a one-time screening. If you were looking for something to permanently include in FxCop analyses, it would need to be fancied-up a bit.

    private TypeNode PageType { get; set; }
    
    private TypeNode FocalType { get; set; }
    
    public override void BeforeAnalysis()
    {
        base.BeforeAnalysis();    
        this.PageType = FrameworkTypes.Page;
    }
    
    public override ProblemCollection Check(TypeNode type)
    {
        if (type.IsDerivedFrom(this.PageType))
        {
            this.FocalType = type;
            this.Visit(type);
        }
    
        return this.Problems;
    }
    
    public override void VisitTypeReference(TypeNode type)
    {
        if ((type != null) && (type != this.FocalType) && type.IsDerivedFrom(this.PageType) && (!this.FocalType.IsDerivedFrom(type)))
        {
            this.Problems.Add(new Problem(this.GetResolution(type.FullName), type));
        }
    
        base.VisitTypeReference(type);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application where I need to find all classes that accesses
I've got a .NET library in which I need to find all the classes
I need to find all the regex matches from a list of strings. For
I need to find all image files from directory (gif, png, jpg, jpeg). find
I have a table of time-series data of which I need to find all
I need to find all occurrences of a function call in a C++ file
I need to find all instances of strings within an xml node. To be
I need to find all descendants of a category using HierarchyID for SQL Server
I have a need to find all of the writable storage devices attached to
Let's say i need to find all .bar elements inside an element that's assigned

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.