Let's briefly describe the method:
1. Obtain the source code of the. aspx page class.
In C: Windows Microsoft. NETFrameworkv1.1.4322Temporary ASP. NET Files directory, you can see your site and virtual directory name, click in to find your page class, but note that the name of this page class has little to do with your original name, you can also find it on the error page through the trap:
Source File: c: WINDOWSMicrosoft. NETFrameworkv1.1.4322Temporary ASP. NET Filesoot6e5a7fb154c3fdebehrvxfn5.0. cs row: 90
(Add any location on the aspx page to set a trap and obtain the source file for compilation)
Ii. Compilation
Obtain the source file and comment out the dependency items, as shown in figure
// Dependencies. Add ("W: wwwrootdlltestex2.aspx ");
Then compile
Method 1
Open VS, create a WEB project, include these page classes, comment out the page dependencies, and set the image compilation type to embedded.
Method 2
Without VS, you can use the csc/vbc compiler to complete the compilation. For how to use the compiler to compile the project, refer to: http://www.bestaspx.net/Articles/Show.aspx? ArticleID = 21
Of course, images can also be packaged, so that all the stuff is written into the dll.
The following is a brief description of how to compile images into the dll in the command line.
C: Program FilesMicrosoft Visual Studio. NETFrameworkSDKSamplesTutorialsesourcesandlocalizationesxgen
Resxgen.exe/I: logo.gif/o: test_res.resx/n: logo
Obtain the resource file test_res.resx, And you can reference the resource compilation in the command line.
Unable to get resxgen can be downloaded here: http://www.bestaspx.net/down/ResXGen.zip
Source code: http://www.bestaspx.net/down/ResXGen_Src.zip
For details about how to use resource files in the project, see:
Assembly myAssem = Assembly. GetExecutingAssembly ();
ResourceManager rm = new ResourceManager ("namespace. 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. Create a dll ing from aspx to dll
In the httpHandlers section of system. web Section of web. config in the Asp. Net application configuration file, add the ing items from aspx to dll. The syntax is as follows:
<Add verb = "*" path = "aspx file name" type = "Class Name, dll file"/>
Iv. Test
After completing the above three steps, all the work has been completed. Let's test it. Open IE and enter
Http: // localhost/virtual directory name/aspx file name to view the effect.
Because I tried it a long time ago and now it is written by memory, it is messy. If you have any questions, contact me.