I used to see that someone asked how to compile the DLL on the CSDN Forum on the CSDN Forum, and answered at the time. Later, I felt that there may be someone to use it, so I recently organized the article.
You can see the DLL you do
http://www.bestaspx.net/down/allindll.zip
Let me talk about the method first:
1. Get the source code of the .aspx page class
In C: /windows/microsoft.net/framework/v1.1.1.4322/temporary asp.net Files directory, you can see your site and virtual directory name, click in and find your page class, but pay attention The name is not very connected with your original name, you can also find it directly on the wrong page through the trap:
Source file: C: /windows/microsoft.net/framework/v1.1.4322/temporary asp.net files/root/6E5A7FB1/54C3FDEB/EHRVXFN5.0.cs Line: 90
(Add the trap to the any position of the ASPX page, and get the compilation source file)
Second, compile
Through the source files above, annotation of dependency items: such as
//dependencies.add 18://wwwroot/dlltest/ex2.aspx ");
Then compile
Method one
Open VS, create a new web project, include these page classes in and annotate the page dependencies, and set the compile type of the picture to embedded.
Method two
Those without VS can be compiled with CSC/VBC compilers. For how to compile items with compilers, please refer to: http://www.bestaspx.net/articleS/show.aspx? Articleid = 21
Of course, the picture can also be packed, so that all the stuff entered the DLL
Let's briefly talk about how to compile the picture into DLL in the command line
C:/Program Files/Microsoft Visual Studio .NET/Frameworksdk/SAMPLIALS/ResourceSAndLocalization/ResXGEN
resxgen.exe /i:logo.gif /o:Test_res.Resx /n: logo
Get the resource file test_res.resx, and you can compile the resource in the command line.
If you can't get resxgen, you can download it here: http://www.bestaspx.net/down/resxgen.zip
Source code: http://www.bestaspx.net/down/resxgen_src.zip
So how to use resource files in the project, please see:
assembly myAssem = Assembly.GetexecutingAssembly ();
ResourceManager RM = New ResourceManager ("Name Space .test_res", MyAssem);
System.Drawing.image Objgraphics = (System.Drawing.image) rm.getObject ("logo");
objgraphics.save (response.outputstream, system.drawing.imaging.imageFormat.gif);
objgraphics.dispose ();
3. Establish a mapping from ASPX to DLL
Add ASPX to DLL mapping items in the httphandlers section of the System.Web section of the System.Web section of the ASP.NET application. The grammar is as follows:
<add Verb = "*" PATH = "ASPX file name" Type = "class name, dll file" />
Fourth, test
Through the above 3 steps, all the tasks have been completed.
http: // localhost/virtual directory name/ASPX file name view effect.
Because it was a long time ago, it is written by memory, so it is more chaotic. If you have any questions, you can contact me.
Business source code popular download www.html.org.cn