简体   繁体   English

动态创建ASP.NET内容页面

[英]Dynamically Create ASP.NET Content Pages

  • Is it possible with ASP.NET Master Pages to create content pages dynamically? ASP.NET Master Pages是否可以动态创建内容页面? That is, I know we can create content dynamically, but the content pages themselves, can those be created programmatically? 也就是说,我知道我们可以动态创建内容,但内容页面本身是否可以通过编程方式创建? I want to give my users the ability to define new content pages (ie Categories: Sofas, Tables, Lamps, and add/delete as they see fit) through a management panel. 我希望通过管理面板为我的用户提供定义新内容页面(即类别:沙发,桌子,灯具,以及他们认为合适的添加/删除)的能力。 The resulting content pages should have proper URL naming, so that they index properly. 生成的内容页面应具有正确的URL命名,以便它们正确索引。 An example: http://www.example.com/products/Lamps/contentpage.aspx . 例如: http//www.example.com/products/Lamps/contentpage.aspx
  • Is there a demonstration of this somewhere I can view? 我能看到这个地方的演示吗?

Your question is something people struggled alot back then, but these days are much better with a few technologies. 你的问题是当时人们挣扎的问题,但现在用一些技术会好得多。

ASP.NET MVC to the rescue! ASP.NET MVC来救援! With that, you can have your friendly URLs map to your dynamically created content, so if a user creates a new "Lamp" in the "Products" category, it will be accessed via http://yourhost/Products/Lamp 这样,您可以将友好的URL映射到动态创建的内容,因此,如果用户在“产品”类别中创建新的“灯泡”,则可通过http:// yourhost / Products / Lamp访问

ASP.NET MVC uses the .NET Routing to accomplish those URLs, and you can use that without a ASP.NET MVC itself if your project have those restrictions. ASP.NET MVC使用.NET Routing来完成这些URL,如果您的项目有这些限制,您可以在没有ASP.NET MVC的情况下使用它。 If you cannot use .NET 3.5, go with another URL rewrite tech. 如果您不能使用.NET 3.5,请使用其他URL重写技术。

Writing .aspx files into your web's folders seems like a serious security risk. 将.aspx文件写入Web文件夹似乎是一个严重的安全风险。 If you want users to create their own pages, you might want to store this information in a database and use a VirtualPathProvider to serve up these files to the ASP.NET engine. 如果您希望用户创建自己的页面,您可能希望将此信息存储在数据库中,并使用VirtualPathProvider将这些文件提供给ASP.NET引擎。

You could use the TextWriter class and create all the pages and code behinds you want. 您可以使用TextWriter类并创建所需的所有页面和代码。 That would be a pain forsure but it would work, although i've never done it before, you might run into some issues since it wouldnt be compiled. 这将是一个痛苦的事,但它会起作用,虽然我以前从未这样做过,你可能会遇到一些问题,因为它不会被编译。 you can definitely make html static pages 你绝对可以制作html静态页面

If you are looking to build your own, that would be a very tedious job. 如果你想建立自己的,那将是一项非常繁琐的工作。 It would be better to purchase or use an open source content management system to do the job. 最好购买或使用开源内容管理系统来完成这项工作。 There are many on the market that are available to you in both categories. 市场上有很多可供您使用的产品。 This is the primary feature for this type of software package. 这是此类软件包的主要功能。

Check out www.codeplex.com for some, or there are others to buy like Telligent's package or Telerik's Sitefinity. 查看www.codeplex.com了解一些,或者还有其他人可以购买像Telligent的软件包或Telerik的Sitefinity。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM