Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically Create ASP.NET Content Pages

  • 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?
like image 499
Robert Kerr Avatar asked Jan 22 '10 19:01

Robert Kerr


2 Answers

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.

like image 66
Francisco Aquino Avatar answered Oct 16 '22 02:10

Francisco Aquino


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.

like image 38
Teun D Avatar answered Oct 16 '22 02:10

Teun D