Compile .aspx files and pictures into the DLL

xiaoxiao2021-03-05  23

I used to see someone asked how to compile the .aspx page into the DLL at the 9CBS Forum. Later, I felt that someone would have to use it, so I will put the article recently.

Everyone can take a look at the DLLHTTP: //www.bestaspx.net/down/allindll.zip

Let me briefly say the method first:

First, get the source code of the .aspx page class

In the C: /Windows / Microsoft.Net/framework/v1.1.4322/temporary asp.net files directory, you can see your site and virtual directory name, you can find your page class, but pay attention to this page class The name is not much contact with your original name, you can also find it directly in the error page through traps:

Source file: c: /windows/microsoft.net/framework/v1.1.4322/temporary ASP.NET FILES / ROOT / 6E5A7FB1 / 54C3FDEB / EHRVXFN5.0.CS line: 90

(Add anywhere in the ASPX page

You can set the trap and get the control source file)

Second, compile to get the source file above, note the dependencies: like //dependencies.add ("w://wwwroot//dllteest//ex2.aspx "); then compile the method to open the VS, create a new web project, To include these page classes and comment out of the page dependencies, set the compilation type of the image to embed. Method Two

Without VS can be compiled with the CSC / VBC compiler, with the compiler compile item, you can refer to: http://www.bestaspx.net/Articles/show.aspx? ArticleId = 21 Of course, the picture can be packaged in, In this way, all stuffs have entered the DLL. Below you must simply say how to make pictures in the command line DLL

Use the C: / Program Files / Microsoft Visual Studio .NET / FrameworkSdk / Samples / Tutorials / ResourcesAdlocalization / Tutorials / N: LOGO to get the resource file test_res. RESX, you can compile the resource in the command line. You can't get RESXGEN to download: http://www.beestaspx.net/down/resxgen.zip source code: http://www.beestaspx.net/down/resxgen_src.zip So how do you use a resource file in your project? Gentlemen 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 ();

Third, the mapping of the ASPX to DLL is added in the ASP.NET application configuration file Web.config's httphandlers section to add ASPX to DLL mapping items, the syntax is as follows:

Fourth, test

Through the above 3, all the work has been completed. Test it below, open the IE, enter the http: // localhost / virtual directory name / aspx file name to view the effect. Because it was a long time ago, it is now written, so it is more chaotic. If you have any questions, please contact me.

转载请注明原文地址:https://www.9cbs.com/read-38015.html

New Post(0)