Is it possible to process an ASP.NET ASPX page from a source that is not a file system?

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!

+3
source share
3 answers

Perhaps you need a virtual path provider . It allows you to store ASPX and codebehind in different environments - RDBMS, xml file, etc.

+5
source

: korchev virtualpathprovider, .

?

, , :

ASP.NET HttpHandler

:

+1

I knew that SharePoint Server is used to store ASPX pages in a database, not in the file system. Details, however, I do not adhere to.

0
source

Source: https://habr.com/ru/post/1697733/


All Articles