Search Options
close
Search the following clips:
All Clips
Everyone's Clips
My Guides
Sign Up
Install
Learn More
Login
Loading an ASP.NET Page Class dynamically in an HttpHandler
travislaborde
follow
2
8-2-2007 9:08 AM
403 views
tags:
programming
,
asp.net
travislaborde
says:
not sure why I find this interesting, but I'm sure one day I'll do it
Add a Comment
Login
to Comment. Not a member yet?
Sign up
Related Clips
Self Assembly Robots Will Save Your Life
The Future Of Code, Digital And Genetic Co...
Favorite Programming Quotes
The Great Depression Hoax
MSNBC's Network Chief Down Plays The Pers...
Free Online Courses from Great Universities
OH voting machines contain critical vote-d...
More clips from
travislaborde
Search and Give? Awesome!
Ignite Your Life: Relationships – No Man I...
How "The Price is Right" SHOULD Work :)
Today's Top Clips
Five Women Buried Alive - and the Media Ignore It
List of books Palin wanted banned--wow!
Study: Credit Cards Cause More Spending
Who thinks this is a good reason to remove an account?
"A dishonorable lust for office"
Amazingly Creative Art
The Teen Brain
Mystery of the 'couple' buried arm in arm 1,000 years ago
Fear Is The Cheapest Room In The House
The Omnigoogle
visit the
Top Clips page
View the Top Clips from
August 2, 2007
Embed This Clip In Your Site...
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: #ffffff; border: solid 4px #e5e5e5; width: 100%; clear: left;"><div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px;background-color: #ffffff;"><div style="border-bottom: solid 1px #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee ;background-image: url(http://clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;" ><a href="http://clipmarks.com/clip-to-blog/" title="see clips that are hot right now"><img src="http://content.clipmarks.com/blog_embed/3322e1bf-c0ab-47ba-84c9-5c9c71d18dc7/05FB214B-D07F-4EFC-96EC-CA29E8858983/" alt="" width="19" height="19" border="0" style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float:none;" /></a>clipped from <a title="http://www.west-wind.com/weblog/posts/120530.aspx" href="http://www.west-wind.com/weblog/posts/120530.aspx" style="font-size: 11px;">www.west-wind.com</a></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.west-wind.com/weblog/posts/120530.aspx">Loading an ASP.NET Page Class dynamically in an HttpHandler</blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.west-wind.com/weblog/posts/120530.aspx">I ran into an interesting post on the ASP.NET forums today where someone is trying to dynamically invoke a page class inside of an HttpHandler. Basically the idea is that you have a class for the page that exist and you're dynamically invoking the class rather than letting the ASP.NET BuildManager deal with loading the page from disk and doing its thing.</blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.west-wind.com/weblog/posts/120530.aspx"><SPAN>public</SPAN> <SPAN>class</SPAN> <SPAN>TestHandler</SPAN> : System.Web.<SPAN>IHttpHandler </SPAN> { <SPAN>public</SPAN> <SPAN>bool</SPAN> IsReusable { <SPAN>get</SPAN> { <SPAN>return</SPAN> <SPAN>false</SPAN>; } } <SPAN>public</SPAN> <SPAN>void</SPAN> ProcessRequest(System.Web.<SPAN>HttpContext</SPAN> context) { <SPAN>//Page page = BuildManager.CreateInstanceFromVirtualPath("/weblog/schedulerTest.aspx", typeof(SchedulerTest) ) as Page; </SPAN> <SPAN>//BuildManager.GetVirtualPathDependencies("/weblog/testpage.axd"); </SPAN> <SPAN>Page</SPAN> page = <SPAN>new</SPAN> <SPAN>SchedulerTest</SPAN>(); // An ASPX Page class (note: CodeBehind) <STRONG>page.AppRelativeVirtualPath = context.Request.AppRelativeCurrentExecutionFilePath; </STRONG> page.ProcessRequest(context); } }</blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.west-wind.com/weblog/posts/120530.aspx">There are a couple of big gotchas</blockquote></div><div style="margin: 0px 6px 6px 4px;"><table style="font-size: 11px;border-spacing: 0px;padding: 0px;" cellpadding="0" cellspacing="0" width="100%"><tr><td style="background:transparent;border-width:0px;padding:0px;"> </td><td align="right" style="background:transparent;border-width:0px;padding:0px;width:107px" width="107"><a href="http://clipmarks.com/share/05FB214B-D07F-4EFC-96EC-CA29E8858983/blog/" title="blog or email this clip"><img src="http://content7.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" style="border-width:0px;padding:0px;margin:0px;" /></a></td></tr></table></div></div>
Clipmarks
Home
New Clips
Top Clips
Dashboard
Popular Topics
News
Life
Science
Technology
Entertainment
Get Started
Sign Up
Install Clipping Tool
How Clipping Works
Clip-to-Blog™
ClipSearch
Tools and Resources
FAQ
ClipWeek
Top Clippers
Top Tags
Site Map
About Clipmarks
About Us
Contact
Blog
Copyright
Privacy
EULA
OK