How to get a compiled version of an aspx page to reflect

Given the path to the aspx page on my site that was previously compiled, how to get the path to the compiled version (dll or other) from the second page on my site so that I can examine its properties, methods and classes using reflection

Or any other way to generate method / property lists from aspx pages?

0
source share
4 answers

What you are looking for should be in the bin folder of your server. Due to security issues, you cannot access the bin folder through the browser. Thus, you will need to open your ISS server folder either with the ftp client or from the server locally. You can then use the reflector against it as soon as you load it.

+1
source

I believe that both of them should be in the same assembly. You can check it out.

Just remove the following snippet at the top of the aspx page:

<%=this.GetType().Assembly.Location %>

This will give you the dll directory. Alternatively, you can do this:

<%=typeof(MyWebsite.TargetPageType).Assembly.Location %>

substituting the type of page you want to explore.

0
source

, :

System.Web.Compilation.BuildManager.GetCompiledType(Me.Request.Url.AbsolutePath)
0

ASP.Net , , BuildManager, , . , , , - .

var pg = System.Web.Compilation.BuildManager.GetCompiledType([relative path]);

, , , :

var pg = this;

Everything using Assembly.Location to dynamically load assemblies from this path is incorrect and may even break your application. If you do this, you run the risk of loading the old assembly - and when an ASP.NET worker finds out that she needs to recompile this thing, loading the new assembly may fail due to name conflicts. You are also looking at old code. Shorten it: don't do it.

0
source

All Articles