<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>HttpHandlers and HttpModules</title><link>http://forums.asp.net/27.aspx</link><description>Extending the ASP.NET Framework through HttpModules and HttpHandlers.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Entire page in assembly</title><link>http://forums.asp.net/thread/1831035.aspx</link><pubDate>Mon, 30 Jul 2007 17:06:40 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1831035</guid><dc:creator>DEHAAS</dc:creator><author>DEHAAS</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1831035.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1831035</wfw:commentRss><description>&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;I have now returned from my vacation.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;I have tried your approach, but I can&amp;#39;t seem to get it working correctly. I do not get an error-message, but the page my handler returns is absolutely empty.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Respectfully,&lt;/font&gt;&lt;/font&gt;&lt;/span&gt; 
&lt;p&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Christopher de Haas&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Re: Entire page in assembly</title><link>http://forums.asp.net/thread/1806996.aspx</link><pubDate>Tue, 17 Jul 2007 04:38:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1806996</guid><dc:creator>DEHAAS</dc:creator><author>DEHAAS</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1806996.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1806996</wfw:commentRss><description>&lt;p&gt;Sorry about my late answer, but I am currently on vacation.&lt;/p&gt;
&lt;p&gt;This seems it&amp;nbsp;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&amp;nbsp;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?&lt;/p&gt;</description></item><item><title>Re: Entire page in assembly</title><link>http://forums.asp.net/thread/1797008.aspx</link><pubDate>Wed, 11 Jul 2007 01:06:13 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1797008</guid><dc:creator>rstrahl</dc:creator><author>rstrahl</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1797008.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1797008</wfw:commentRss><description>&lt;p&gt;You can do this by creating a&amp;nbsp;separate ASP.NET project (WAP or stock)&amp;nbsp;and compiling it with Web Deployment projects into a single assembly. It works better with WAP projects because you&amp;#39;ll get to set the class name rather than ASP.NET creating a dynamic name you&amp;#39;ll have to figure out later with Reflector. Anyway once you&amp;#39;ve compiled with Web Deployment projects you&amp;nbsp;have a single assembly that contains both the code behind and the compiled markup code.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;I wrote about this&amp;nbsp;process here a while back:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://west-wind.com/WebLog/posts/8191.aspx"&gt;http://west-wind.com/WebLog/posts/8191.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As it turns out I&amp;#39;ve never actually put this to use though. I found it gets pretty tricky when you&amp;#39;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&amp;nbsp;ensure that the form is truly self contained. It&amp;#39;s quite a bit of work of making this clean and easy but&amp;nbsp;I suppose in some scenraios no extra resources may be required.&lt;/p&gt;
&lt;p&gt;+++ Rick ---&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Entire page in assembly</title><link>http://forums.asp.net/thread/1795776.aspx</link><pubDate>Tue, 10 Jul 2007 13:12:23 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1795776</guid><dc:creator>sujitm</dc:creator><author>sujitm</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1795776.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1795776</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;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&amp;#39;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 the response.&lt;/p&gt;
&lt;p&gt;I have never tried this but theoretically I don&amp;#39;t see any problem with this approach. Let us know if it really worked. ;)&lt;/p&gt;</description></item><item><title>Re: Entire page in assembly</title><link>http://forums.asp.net/thread/1795395.aspx</link><pubDate>Tue, 10 Jul 2007 09:37:35 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1795395</guid><dc:creator>DEHAAS</dc:creator><author>DEHAAS</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1795395.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1795395</wfw:commentRss><description>&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Thanks for your reply.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;I have been trying that, but it is not exactly what I am looking for. This approach gives me the ability to encapsulate all my code-behind in an assembly, but I still need the markup file (which is what I am trying to get rid of).&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;</description></item><item><title>Re: Entire page in assembly</title><link>http://forums.asp.net/thread/1791896.aspx</link><pubDate>Sat, 07 Jul 2007 14:08:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1791896</guid><dc:creator>Bravo9</dc:creator><author>Bravo9</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1791896.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1791896</wfw:commentRss><description>&lt;font size="1"&gt;
&lt;p&gt;When you add a new page to a website you will notice the following line at the top of the .aspx file:&lt;/p&gt;
&lt;p&gt;&amp;lt;%&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;@&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#a31515" size="1"&gt;Page&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;Language&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;=&amp;quot;C#&amp;quot;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;AutoEventWireup&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;=&amp;quot;true&amp;quot;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;CodeFile&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;=&amp;quot;testPage.aspx.cs&amp;quot;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;Inherits&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;=&amp;quot;testPage&amp;quot;&lt;/font&gt;&lt;font size="1"&gt; %&amp;gt;&lt;/font&gt;&lt;font size="1"&gt;&amp;nbsp;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="1"&gt;What you need to do is move the underlying .cs file&amp;nbsp;into your assembly (you will need to reference System.Web).&amp;nbsp;I typically put my type (which inherits from Page) in its own namespace.&amp;nbsp; Once you compile the assembly you can then get rid of the &amp;quot;CodeFile&amp;quot; attribute change the .aspx file to look like this:&lt;br /&gt;&lt;br /&gt;&amp;lt;%&lt;font color="#0000ff" size="1"&gt;@&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#a31515" size="1"&gt;Page&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;Language&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;=&amp;quot;C#&amp;quot;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;AutoEventWireup&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;=&amp;quot;true&amp;quot;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;Inherits&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;=&amp;quot;myNamespace.testPage&amp;quot;&lt;/font&gt;&lt;font size="1"&gt; %&amp;gt;&lt;/font&gt;&lt;font size="1"&gt;&amp;nbsp;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="1"&gt;&amp;nbsp;A downfall of this approach is that Visual Studio can&amp;#39;t resolve the underlying .cs file when you select &amp;quot;View Code&amp;quot; .&lt;/font&gt;&lt;font size="1"&gt;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Entire page in assembly</title><link>http://forums.asp.net/thread/1784845.aspx</link><pubDate>Tue, 03 Jul 2007 13:40:10 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1784845</guid><dc:creator>DEHAAS</dc:creator><author>DEHAAS</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1784845.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1784845</wfw:commentRss><description>&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Hi,&lt;/font&gt;&lt;/p&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;I am currently working on a rather big project, and I am in great need of help for trying to use ASP.NET in a way it probably was not intended to, or at least not is a very common approach.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;I want to put an entire WebForm into an assembly (not pre-compiled). This means only having an instance of the Page Class without the markup (.aspx). I have been trying to do this before, but I abandoned the idea because I simply could not make it work. However, now I really need a solution.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;First step was determine when to return this specific page. In order to do this, I made a class which inherited from the System.Web.UI.PageHandlerFactory. Here I have developed a little piece of code that determines which hander to return according to the url, pretty simple really.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Then I created a new class which inherited from the System.Web.UI.Page to be returned for this special page.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;So far everything works wonderfully, the special handler is returned when it have to. However, now all the problems surface. First of all, the handler renders ‘nothing’ – the rendered HTML is just empty. Then I tried adding a label-control to the page at the load-event. Then the handler returned &amp;lt;span&amp;gt;text&amp;lt;/span&amp;gt;.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;All right I needed a header and a body, so I tried adding those at the Init event. System.Web.UI.HtmlControl.HtmlHeader and .HtmlBody&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Now when I try to append a control like a Button is says that my form must contain the runat=”server” attribute. I have tried adding af HtmlForm control to the HtmlBody, but I get the same result.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt; 
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;I really hope someone can help me in resolving this issue.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;</description></item></channel></rss>