To compile an. aspx file and a picture into a DLL

Source: Internet
Author: User
Tags command line resource zip
Compile
I have previously seen a question in the CSDN forum about how to compile the. aspx page into the DLL, which was answered. Later thought that maybe someone will use, so recently put the article tidy up.
You can take a look at the good DLL
Http://www.bestaspx.net/down/allindll.zip
First of all, a brief introduction to the method:
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 can see your site and virtual directory name, click in to find your Page class, But note that the name of this page class is not much in contact with your original name, and you can find it directly in the error page by trapping:
Source file: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary asp.net files\root\6e5a7fb1\54c3fdeb\ehrvxfn5.0.cs line: 90
(Add a trap at any location in the ASPX page to get the compiled source file)
Second, compiling

Get the source file from the above and comment out the dependencies:
Dependencies. ADD ("w:\\wwwroot\\dlltest\\ex2.aspx");
and then compile

Method One

Open VS, create a new Web project, include these page classes in and comment out page dependencies, and set the picture's compilation type to embed.

Method Two
Without VS, you can compile with the CSC/VBC compiler, about how to compile the project with the compiler can refer to: http://www.bestaspx.net/Articles/Show.aspx?ArticleID=21

Of course, the picture can also be packed in, so that all the stuff into the DLL
Let's say a little bit about how to edit a picture into a DLL at the command line
Use the C:\Program Files\Microsoft from the SDK to Visual Studio. net\frameworksdk\samples\tutorials\resourcesandlocalization\ ResXGen
Resxgen.exe/i:logo.gif/o:test_res.resx/n:logo
When you get the resource file Test_res.resx, you can refer to the resource compilation at the command line.
Can not get ResXGen to download here: Http://www.bestaspx.net/down/ResXGen.zip
Source: Http://www.bestaspx.net/down/ResXGen_Src.zip

So how do you use resource files in your project, and you 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 ();
Iii. creating a mapping of ASPX to DLLs

Add the mapping entry for ASPX to DLLs in the httphandlers section of the system.web section of the asp.net application configuration file web.config, which is the following syntax:
<add verb= "*" path= "aspx filename" type= "class name, dll file"/>
Four, test
Through the above 3 steps, has completed all the work, the following test, open ie, input
http://localhost/the virtual directory name/aspx the file name to see the effect.
Because it is a long time ago the experiment, now is written by memory, so more messy, if there are problems can contact me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.