My objective is to write a program that can create folders and within those folders create Default.aspx pages. The Default.aspx pages must read information from the database to populate the page using their containing folder name as a parameter to call the database.
Create the folders is the easy part, but I'm not sure how to go about writing information to .aspx files.
The goal of this project is so a real estate company can create pages for featured propertie开发者_Go百科s (through a cms), each featured property getting it's own folder/page.
Any feedback would be great. -Aaron
Rather than physically creating the .aspx files, I think it makes more sense to have 1 .aspx file, which is passed querystring values to return different content from the CMS, depending on its value.
Furthermore, you could use URL Rewriting to make the file appear as if its in a physical location, within a folder.
For example:
/Property.aspx?agent=EstateAgent1&name=Property1
Can be rewritten to:
/EstateAgent/Property1.aspx
If you have to generate folders and files, I'd recommend simply generating HTML files, as theres no need for the file to be dynamic, or ran at the server
I would create a template ASPX page, and copy that template into the new folders. Within the template, define the layout and add all of the necessary controls for displaying the data. Doing it this way, you can change your template as needed for changes, and after the template is copied to the folder you can customize it as needed.
I would be remiss not to warn you that this approach will be very difficult to maintain though. Unless there is some requirement I'm unaware of, I don't know why this approach would be favorable.
Hope this helps.
精彩评论