Is there a way to execute a complete ASPX source file in which the page source is from a string / database / resource, not a file in the file system? This is straightforward for rendering dynamic content / images / etc using HTTP handlers and modules and writing to Response, but there seems to be no way to execute / compile an ASPX source without a file on the file system. For instance:
- Overloading HttpContext.Current.Server.Execute () requires a file path
- System.Web.Compilation.BuildManager can only create a virtual path
The goal is to be able to run a string source, such as the following from a handler / module / ViewEngine, and not require a file in the file system (but get the source from another location):
<%@ Page language="C#" MasterPageFile="~/Shared/Site.Master" Inherits="System.Web.UI.Page" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>ListView Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>ListView Example</h3>
<asp:ListView ID="List" runat="server" DataSourceID="ProductDataSource">
<LayoutTemplate><ol><asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder></ol></LayoutTemplate>
<ItemTemplate><li><%# Eval("ProductName") %></li></ItemTemplate>
</asp:ListView>
<asp:AccessDataSource ID="ProductDataSource" runat="server"DataFile="~/App_Data/Northwind.mdb"SelectCommand="SELECT [ProductName], [QuantityPerUnit], [UnitPrice], [CategoryName] FROM [Alphabetical List of Products]"></asp:AccessDataSource>
</form>
</body>
</html>
(NOTE: The example above is just a simple example, but shows the use of server controls, data binding syntax, the main page, and possible declarations of user controls in page directives, etc.)
Hope this makes sense!
Chris
source
share