Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm programatically looking into an .aspx file and getting the file class name declared in its CodeBehind. For example, when analyzing myFile.aspx, I read in its Page Directive and found its CodeBehind equals "myApplication\myPage.aspx.vb". Then I use the code below:

Dim Assm As System.Reflection.Assembly = System.Reflection.Assembly.LoadFrom("myApplication\bin\myApplication.dll")
Dim ClassType As Type = Assm.GetType("myApplication\myPage.aspx.vb")

' myBaseType = "myApplication.Forms.BasePage"
Dim myBaseType As System.Type = ClassType.BaseType


Now I want to read the BaseFile (class = myApplication.Forms.BasePage). However, to read in this file, I need to get its full path instead of its namespace.class hierarchy. In this case, the BasePage is wrapped in a different namespace declaration, thus I cannot just change the '.' to '\' in order to get the path.

How can I get the path of BasePage so I can read it? Thank you - Frank
Posted
Updated 26-Aug-10 8:09am
v2

Try this (no guarantees, but it might give you a place to start):

String strPath = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetAssembly(ClassType.BaseType));
 
Share this answer
 
Thanx John,

Unfortunately, GetDirectoryName() expects a string...but GetAssembly() returns a type.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900