Hi,

I'm working on an events section for a website and have run up against the following problem: I would like every event registered to have its own web page on the site. What I would like to do is to have a template with basic layout, etc., and then every time a new event is entered, a new page would automatically be created in a specific folder on the site with the name mysite/events/name of event, with all the information from the database, or that was entered into the form, correctly laid out in as I specified in the template.

I know this sounds crazy, but is there any way to do this programmatically? I have no way of knowing how many events will be registered, so I can't set up the pages beforehand and then fill in the info.

I originally did it by sending a querystring with the event id to a single reused eventsdetails page that used the id to pull all data about that event out of the database, but my boss wants to have a higher search ranking by having more pages on the site, so he wants one page per event.

Thanks a lot in advance,
Bsg

Your original solution will work fine, I suggest you use some url rewrites to achieve the impression that there are multiple event pages on the site. One simple way is to use an assembly called UrlRewriting.net http://www.urlrewriting.net/149/en/home.html this is a free URL rewriting module, this would enable you to map a url like: www.mysite.com/event1234.aspx to your dynamic url
www.mysite.com/event.aspx?eventid=1234

this is achieved by using regular expression filters in your web config file. Essentially you still only have the one dynamic page, but the search engines will see a single page for each event.

You could of course generate a static html page in code for each new event and save the file to your web server, but your application would need to have write access to the events folder.

Your original solution will work fine, I suggest you use some url rewrites to achieve the impression that there are multiple event pages on the site. One simple way is to use an assembly called UrlRewriting.net http://www.urlrewriting.net/149/en/home.html this is a free URL rewriting module, this would enable you to map a url like: www.mysite.com/event1234.aspx to your dynamic url
www.mysite.com/event.aspx?eventid=1234

this is achieved by using regular expression filters in your web config file. Essentially you still only have the one dynamic page, but the search engines will see a single page for each event.

You could of course generate a static html page in code for each new event and save the file to your web server, but your application would need to have write access to the events folder.

Thank you very much for your answer. Just to clarify: I read the documentation for the module you suggested, and it does say that search engines will be able to find the url for the web site as part of their keyword searches. However, what my boss wants is to have a lot of pages on the site to improve our search ranking. Will this solution work for that? If I only actually have one page, which gets its url changed dynamically, how does a search engine see that as hundreds of pages with separate url's?

If this wouldn't work for my purposes, how would I go about creating HTML pages in code? I would need to set the url's to the same sort of one that you suggested before, and to fill in information from the database into a template. Is that at all possible?

Thank you so much for all your time.

Bsg

I think what is required here is a basic understanding of how search engine spiders work. Typically they find new pages by following links to then from other pages. So if you link to the pages properly using the Event1234.aspx url then the search engine will find them.

Search engines do not check the contents of a folder to find new pages, so having physical .html files will not give you any benefit over a properly rewritten dynamic url. You can help the major search engines to find your pages by submitting xml sitemap files or just having a sitemap file and pointing your robots.txt file to it, you can also prevent a search engine from spidering your dynamic url by adding the appropriate rule to your robots file.

You can easily find articles about programmatically creating any type of file you could want, but bear in mind that your application will need write access to the folder you will be writing to and essentially you will only be wasting space on your server. However, there are some instances where this can be desirable, for example if you wanted to remove the database dependancy from your application. For example blogengine.net can use XML files to store all the data it needs without requiring a database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.