Reputation: 12431
I'm working on a drop in assembly that has predefined pages and usable controls. I am having no difficulties with creating server controls, but I'm wondering what the "best practices" are with dealing with pages in an assembly. Can you compile a page into an assembly and release it as just a dll? How would this be accessed from the client browser's perspective as far as the address they would type or be directed to with a link? As an example, I have a simple login page with the standard username and password text boxes, and the log in button and a "remember me" checkbox, with a "I can't remember my username and/or password" hyperlink. Can I access that page as like a webresource? such as "http://www.site.name/webresource.axd?related_resource_id_codes"
Upvotes: 1
Views: 168
Reputation: 32568
Your best bet if you want to be able to code it and treat it like a real page is to implement a VirtualPathProvider. Using a virtualpathprovider would allow you to embed the actual aspx as a resource (or put it in a database, whatever) and serve it from there, and still use the asp.net page compilation engine.
This would let you still use the visual studio design time tools easily, and prevent you from having to do vast amounts of build customization to precompile the pages. You can see here as well
If you don't want to do that, you can try using the aspnet_compiler tool to precompile the aspx and such pages into a dll. This will require some build customization, and tricks to allow serving the pages from the dll.
Upvotes: 2
Reputation: 85665
You can add an httpHandler element to web.config pointing to your page. Something like:
<httpHandlers>
<add verb="*" path="login.aspx" type="MyPages.LoginPage, MyPages" />
</httpHandlers>
Upvotes: 1