|
From: vunet on 10 Jun 2008 16:46 The friendly URLs in ASP is the goal of my project. However, in ASP there is no obvious page mapping as I researched compared to other languages. What I mean is making www.site.com?page=Home being www.site.com/home/. One of the workaround I know is to use MS XMLHTTP request on www.site.com/home/index.asp page which will get the HTML content of www.site.com?page=Home. I might replace some folder depth if needed in resulting HTML. However, there is another solution of using File System Object to get the file's content (HTML) and display in the same way. The question is: 1) which method is most effective (fast)? 2) are there other methods I missed? Thanks.
From: Evertjan. on 10 Jun 2008 17:52 vunet wrote on 10 jun 2008 in microsoft.public.inetserver.asp.general: > The friendly URLs in ASP is the goal of my project. However, in ASP > there is no obvious page mapping as I researched compared to other > languages. What I mean is making www.site.com?page=Home being > www.site.com/home/. > One of the workaround I know is to use MS XMLHTTP request on > www.site.com/home/index.asp page which will get the HTML content of > www.site.com?page=Home. I might replace some folder depth if needed in > resulting HTML. > However, there is another solution of using File System Object to get > the file's content (HTML) and display in the same way. > The question is: > 1) which method is most effective (fast)? > 2) are there other methods I missed? > Thanks. Use: server.transfer "/myDir/mySubdir/" & request.querystring("page") & ".asp" -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
From: Old Pedant on 10 Jun 2008 23:16 "Evertjan." wrote: > Use: > server.transfer "/myDir/mySubdir/" & request.querystring("page") & ".asp" Ummm...you have his request *BACKWARDS*. He *WANTS* to be able to have customers use the url http://www.mysite.com/home (a so-called "friendly" or "REST-ful" url) and have them end up on http://www.mysite.com/index.asp?page=home His English is reflecting his native language, I think, but his use of "friendly url" is the trigger. From a performance perspective, the only good way to do this in ASP is with a URL-rewriter ISAPI plug-in for the IIS web server. I don't know of any free ones, though some aren't very expensive. If you don't mind a little bit of a performance hit, the easy way to do this is with a CUSTOM 404 Error Page. That is, you use an ASP page for your CUSTOM 404 ERROR handler (and this assumes that your web host *allows* you do do this! most do, but not all) and it simply "inspects" the value of the problem URL (that is, the non-existent www.mysite.com/home) and transforms it into the right format, again using Server.Transfer or Response.Redirect. Google for "ASP Custom 404" and you'll find plenty of hits to help you.
From: p byers on 11 Jun 2008 01:42 Create a "home" folder in the site Make the "default.asp" in that folder do the same as the "home.asp" Pete (Northolt uk) vunet wrote: > The friendly URLs in ASP is the goal of my project. However, in ASP > there is no obvious page mapping as I researched compared to other > languages. What I mean is making www.site.com?page=Home being > www.site.com/home/. > One of the workaround I know is to use MS XMLHTTP request on > www.site.com/home/index.asp page which will get the HTML content of > www.site.com?page=Home. I might replace some folder depth if needed in > resulting HTML. > However, there is another solution of using File System Object to get > the file's content (HTML) and display in the same way. > The question is: > 1) which method is most effective (fast)? > 2) are there other methods I missed? > Thanks.
|
Pages: 1 Prev: End-Of-Life Date for Classic ASP? Next: ASP.NET web app works on some, not all, workstations |