动态创建 ASP.NET 内容页面
- 是否可以使用 ASP.NET 母版页动态创建内容页?
也就是说,我知道我们可以动态创建内容,但是内容页面本身可以通过编程方式创建吗?我想让我的用户能够通过管理面板定义新的内容页面(即类别:沙发、桌子、灯具,并根据需要添加/删除)。生成的内容页面应具有正确的 URL 命名,以便正确索引。
示例: http://www.example.com/products/Lamps/contentpage.aspx 。 - 我可以在某处查看此演示吗?
- Is it possible with ASP.NET Master Pages to create content pages dynamically?
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 (i.e. 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.
An example: http://www.example.com/products/Lamps/contentpage.aspx. - Is there a demonstration of this somewhere I can view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你的问题是当时人们苦苦挣扎的问题,但现在有了一些技术,情况好多了。
ASP.NET MVC 来救援!这样,您就可以将友好的 URL 映射到动态创建的内容,因此,如果用户在“产品”类别中创建新的“灯”,则可以通过 http://yourhost/Products/Lamp
ASP.NET MVC 使用 .NET 路由 来完成这些 URL,并且如果您的项目没有 ASP.NET MVC 本身,则可以使用它有这些限制。如果您无法使用 .NET 3.5,请使用另一种 URL 重写技术。
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! 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
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. If you cannot use .NET 3.5, go with another URL rewrite tech.
将 .aspx 文件写入 Web 文件夹似乎存在严重的安全风险。如果您希望用户创建自己的页面,您可能需要将此信息存储在数据库中并使用 VirtualPathProvider 将这些文件提供给 ASP.NET 引擎。
Writing .aspx files into your web's folders seems like a serious security risk. 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.
您可以使用 TextWriter 类并创建您想要的所有页面和代码隐藏。这将是一个痛苦的事情,但它会起作用,虽然我以前从未这样做过,但你可能会遇到一些问题,因为它不会被编译。你绝对可以制作html静态页面
You could use the TextWriter class and create all the pages and code behinds you want. 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
如果您想建立自己的,那将是一项非常乏味的工作。最好购买或使用开源内容管理系统来完成这项工作。市场上有很多产品可以满足这两个类别的需求。这是此类软件包的主要功能。
请访问 www.codeplex.com 了解一些信息,或者还可以购买其他产品,例如 Telligent 的软件包或 Telerik 的 Sitefinity。
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.