Last post Jul 30, 2007 01:06 PM by DEHAAS
Jul 03, 2007 09:40 AM|DEHAAS|LINK
I really hope someone can help me in resolving this issue.
Jul 07, 2007 10:08 AM|Bravo9|LINK
When you add a new page to a website you will notice the following line at the top of the .aspx file:
What you need to do is move the underlying .cs file into your assembly (you will need to reference System.Web). I typically put my type (which inherits from Page) in its own namespace. Once you compile the assembly you can then get rid of
the "CodeFile" attribute change the .aspx file to look like this:
A downfall of this approach is that Visual Studio can't resolve the underlying .cs file when you select "View Code" .
Jul 10, 2007 05:37 AM|DEHAAS|LINK
Jul 10, 2007 09:12 AM|sujitm|LINK
If the page you are trying to generate is a static HTML page and it does not contain much advanced ASP.Net controls etc, may be you can use following approach. Create an HTML page and embed this page into the assembly where the HttpHandlers and all are residing
so that you don't need to ship the HTML page along with the assembly. Use WebResources to capture the contents of the HTML file embedded in the assembly. Once you have all the HTML contents in the OnLoad() event of the Page class write the HTML contents in
I have never tried this but theoretically I don't see any problem with this approach. Let us know if it really worked. ;)
Jul 10, 2007 09:06 PM|rstrahl|LINK
You can do this by creating a separate ASP.NET project (WAP or stock) and compiling it with Web Deployment projects into a single assembly. It works better with WAP projects because you'll get to set the class name rather than ASP.NET creating a dynamic
name you'll have to figure out later with Reflector. Anyway once you've compiled with Web Deployment projects you have a single assembly that contains both the code behind and the compiled markup code.
Once you have that you can create a custom HttpHandler that can invoke your custom class based on your processing rules. You simply override the ProcessRequest method in the handler and call your Page Class ProcessRequest() method instead.
I wrote about this process here a while back:
As it turns out I've never actually put this to use though. I found it gets pretty tricky when you're dealing with related resources as you pretty much have to make sure all images and styles etc. are properly stowed into the assembly to ensure that the
form is truly self contained. It's quite a bit of work of making this clean and easy but I suppose in some scenraios no extra resources may be required.
+++ Rick ---
Jul 17, 2007 12:38 AM|DEHAAS|LINK
Sorry about my late answer, but I am currently on vacation.
This seems it like a great approach, I will try out as soon as possible. However, I see one problem. I would like make use of MasterPages. This should not be a problem for pages inside of this assembly, but what if I would like to create a new page (not
in the assembly, but a standard .aspx page) inheriting from this MaterPage?
Jul 30, 2007 01:06 PM|DEHAAS|LINK
Christopher de Haas