Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP to HTML

Status
Not open for further replies.

Phudsen

Technical User
Mar 7, 2003
136
A2
Hi,

I have a database on journals, each journal has an ISSN number. When the user searches for a certain ISSN the information of the journal get displayed with a link to the subscritpion.

It is working fine. The hyperlink will be:


It is working perfectly. But my boss would like to see that hyperlink as this.

or
(even though the journal is inside the Journals Folder). He said that this is easier for users to link directly to the journal.

I have looked for this in the internet and came up with something called Generate Static Pages from Dynamic Contents.

Can someone give me guide lines on how to:
- Generate HTML pages from my ShowJournals.asp?
(That means the journal is not saved, it will always be generated like a query)
- When the user types how to pick up the ISSN without .html, read it by ASP and regenerate that page.

I'd appreciate good links some guidelines, if possible code examples.

Thanks a lot
 
You can do this by scripting a custom 404 page

Generating html pages will require some work using the FSO and create .htm pages "on the fly" then use server.transfer to open them. This method can comsume a lot of server resources if the site is a busy one and the pages are quite large. Essentially all it need is a template where some place holder text is in the template, Open the template then run replace() operations with the dynamic text and URLs and write the text stream to disc and transfer the user agent.
The server load can be reduced somewhat by having a modified date in the database, then by checking if the file exists and the created date is newer/same as the db date, skip creation and just transfer. Eventually all files could exist and no 404 errors will occur.

The other way would be to use a directory based URL (domain.com/12345/) this again would not exist so would error out. Recover the directory name/number that was requested and use server.transfer to open "showjournal.asp?ISSN=directory" .

Bear in mind that whenever you use a custom 404 you must make sure that you don't transfer to non-existent pages (locked loop for the server), a robots.txt file must be in place and you have a means of sending a 404 response for any file that really does not exist



Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
My solution would be to tell my boss that if someone bookmarks the page they don't need to type it. Generating (and re-generating) static HTML files for every entry in the database is wasteful of computer resources, time, money, etc.

It is no harder for someone to remember a link with an id in the querystring then to remember a file named with the id.htm. Ie, no one is going to remember either one and if they have to type it somewhere it will be only because they either
a) Already copied it somewhere (see b)
b) have it open in another browser (copy & paste)
or c) have it bookmarked (see b)

HTM files are non-dynamic. You could create an administrative tool that overwrote each htm file each time the database was edited, but HTM files don't have anything that is innately executable, it is a flat file that is simply sent to the end user's browser. If your going to put all the data in static html files, why bother with a database?

The only suggestion I have that wasn't mentioned by Chris is to set up (in the Internet Services Manager) .htm files to be executed by the ASP dll just like .asp extensions are. This would cause all of your HTML files on the server to be executed as ASP, but it would mean those key files you have could have server-side executable code in them. Course you ever upgrade IIS and the whole system would probably die...


My suggestion stays the same. This is a waste of time and resources based on a managerial opinion that is not based on any form of logic. Anyone that could possibly remember a link with an id in the file name is going to have no problem remembering it as a querystring value because they already have 50 times the memory of the average person. And Ctrl+C, Ctrl+V doesn't get any long or shorter whether your copying a 40 character address or a 9000 character address.

In short: this is a very bad idea.

-T



barcode_1.gif
 
Hi Tarwn,

Thank you for your reply, you know that I always value your opinion and take your suggestions into serious consideration.

Quote
------
"The only suggestion I have that wasn't mentioned by Chris is to set up (in the Internet Services Manager) .htm files to be executed by the ASP dll just like .asp extensions are. This would cause all of your HTML files on the server to be executed as ASP, but it would mean those key files you have could have server-side executable code in them. Course you ever upgrade IIS and the whole system would probably die..."
-----------------------------------UnQuote -------------

Do you mean here that I can type ASP code, then name the page as HTML after setting up .htm files to be executed as .asp pages?

Back to the main idea, I agree with you, but the boss saw many huge websites which are database driven but show .htm files.

Thank you Tarwn, but out of curiousity,

- How can this be done, do you have any helpful links or code samples?
- Does it have anything to do with FSO?
- Doesn't this procedure create load on the server since many users will be requesting pages at the same time?
- Does this proceduure improve SEO?

Thank you Tarwn
 
Phudsen


Couldnt you make a virtual directory to the actual path which would make it like the boss wants and leave everthing like you have it.
 
Ah! the light dawns, he is obviously reading about SEO in the wrong places. Querystring URLs are simply not an issue for any search engine (SEO forum828 ).
The big sites using what look like static URLs are probably using a URL rewriting component or they have a CMS running on the site generating the pages.

Application Mappings faq41-3558

Parsing htm pages as asp will make no difference for SEO at all, unless you have many already indexed pages and need to redirect to a new structure or page names.

Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Hi,

Yes Chris, it is URL Rewriting.

Dashely, I don't think it will work in URL Rewriting.

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top