Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Successful way to Rewriting URLs with ASP? (http://www.velocityreviews.com/forums/t804545-successful-way-to-rewriting-urls-with-asp.html)

Toni 11-03-2008 07:19 PM

Successful way to Rewriting URLs with ASP?
 
Does anyone have a recommended method of rewriting URLs with classic ASP?

For example, if the browser shows the Friendly URL
www.mydomain.com/blue_widget

my app will show the following Content Page
http://www.mydomain.com/item.asp?id=...e=d&color=blue

Right now, I'm experimenting with having my error 404 file do the redirect. But it's not
as clean as I'd like - if I do a Server.Transfer or Server.Execute to the content page
(the query strings are passed as session variables), the PATH_INFO shows that the URL is
my error 404 file, which messes up my SmarterStats site statistics (BTW, "Smarter"Stats
is actually pretty dumb).

If my error 404 file performs a Response.Redirect, the address bar sometimes shows the
Content Page URL instead of the Friendly URL, defeating the purpose.

Before deciding to spend the time, energy, and effort to move to ASP.NET 2.0, can anyone
tell me if you've successfully implemented a rewriting URL method that makes you happy?
Can the ASP.NET web.config file be made to work in this to successfully rewrite URLs?

Thanks!!!

Toni








daddywhite 11-03-2008 08:22 PM

Re: Successful way to Rewriting URLs with ASP?
 
http://www.isapirewrite.com/

OR

http://www.qwerksoft.com/products/iisrewrite/

I have sucessfully used both of these on my websites to do URL
rewrites.

For dynamic URLs you still need the ID in the URL somewhere eg:

/product/45/my_product_name.htm ====> /prod_page.asp?ID=45

unless of course you want to write rules for all the individual
dynamic pages, which kinda defeates the point of a URL rewrite and
dynamic website!

Cheers.

Toni 11-03-2008 08:40 PM

Re: Successful way to Rewriting URLs with ASP?
 
Looks nice. But because I'm on a shared server, I'd like to exhaust all other solutions
before I install a server component.


"daddywhite" wrote...
> http://www.isapirewrite.com/
>
> OR
>
> http://www.qwerksoft.com/products/iisrewrite/
>
> I have sucessfully used both of these on my websites to do URL
> rewrites.
>
> For dynamic URLs you still need the ID in the URL somewhere eg:
>
> /product/45/my_product_name.htm ====> /prod_page.asp?ID=45
>
> unless of course you want to write rules for all the individual
> dynamic pages, which kinda defeates the point of a URL rewrite and
> dynamic website!
>
> Cheers.




Anthony Jones 11-04-2008 10:49 AM

Re: Successful way to Rewriting URLs with ASP?
 
"Toni" <Toni24@yahoo.com> wrote in message
news:OyVsQzfPJHA.4712@TK2MSFTNGP06.phx.gbl...
> Looks nice. But because I'm on a shared server, I'd like to exhaust all
> other solutions
> before I install a server component.
>


Then consider other solutions exhausted. The best you can do when all
you've got to play with is native ASP is the 404 hack.

--
Anthony Jones - MVP ASP/ASP.NET


daddywhite 11-04-2008 06:05 PM

Re: Successful way to Rewriting URLs with ASP?
 
Possible other way, but a bit ****, would to PHYSICALLY create a
folder called:"blue_widget". In that have an index.asp page which
defines any variables required and then does a server.execute on the
dynamic page:

############ index.asp in blue_widget folder ##########

Session("pageID") = 67
Server.Execute "displaypage.asp"

################################################

Obviously you would have to have display page use the session pageid
rather than a querystring.

Essentially this is very similar to the 404 hack but not quite as
dynamic so assume you wouldnt want to use this!! Just a thought
though.

Vicent Lauv 01-21-2009 05:49 AM

Re: Successful way to Rewriting URLs with ASP?
 
Hi Toni

I have new to Asp Developer however, i came across as the same your problem.
You would like your page. at www.mydomain.com/blue_widget. It is very simple
way to use your 404 Customer Error Code.

for example: if your site http://www.domain.com/holidays/trip-...tive-osaka.asp

you probablely can have www.domain.com/Trip_for_Active_Osaka

My 404.asp

<%
Dim strURL
Dim strBolum
Dim strSQL

Set strURL = Request.ServerVariables("QUERY_STRING")
strBolum = Split(strURL1,"/")

If strBolum("3") = "Trip_for_Active_Osaka" Then
Server.Execute("holidays/trip-for-active-osaka.asp")

End If

%>

i alraedy implemented this method mostly on www.cambodia-tourism.org
If you need help. You can contact me at Cambodia Tourism Site

Teachnology Change the World.



Evertjan. 01-21-2009 08:16 AM

Re: Successful way to Rewriting URLs with ASP?
 
=?Utf-8?B?VmljZW50IExhdXY=?= wrote on 21 jan 2009 in
microsoft.public.inetserver.asp.general:

> Hi Toni


[please always quote on usenet, this is not email]

> I have new to Asp Developer however,


Sometimes I have new too.

> i came across as the same your problem.
> You would like your page. at www.mydomain.com/blue_widget. It is very
> simple way to use your 404 Customer Error Code.
>
> for example: if your site
> http://www.domain.com/holidays/trip-...tive-osaka.asp
>
> you probablely can have www.domain.com/Trip_for_Active_Osaka
>
> My 404.asp
>
> <%
> Dim strURL
> Dim strBolum
> Dim strSQL


Why "Dim"?

It does not hurt, but in a short piece of asp it is superfluous

> Set strURL = Request.ServerVariables("QUERY_STRING")


Why "Set"?

This is wrong,
as you just assigne a value to a variable.
Set is for objects.

> strBolum = Split(strURL1,"/")
> If strBolum("3") = "Trip_for_Active_Osaka" Then
> Server.Execute("holidays/trip-for-active-osaka.asp")


Why "Server.Execute"?

Use "server.transfer"

because you do not want to come back to 404.asp, meseems

> End If
>
> %>
>
> i alraedy implemented this method mostly on www.cambodia-tourism.org




> If you need help. You can contact me at Cambodia Tourism Site


It is good to have new experts going such length,
but this is usenet. ;-)


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Agile Consulting 02-09-2009 06:47 AM

Re: Successful way to Rewriting URLs with ASP?
 


Vicent Lauv wrote:
> Hi Toni
>
> I have new to Asp Developer however, i came across as the same your problem.
> You would like your page. at www.mydomain.com/blue_widget. It is very simple
> way to use your 404 Customer Error Code.
>
> for example: if your site http://www.domain.com/holidays/trip-...tive-osaka.asp
>
> you probablely can have www.domain.com/Trip_for_Active_Osaka
>
> My 404.asp
>
> <%
> Dim strURL
> Dim strBolum
> Dim strSQL
>
> Set strURL = Request.ServerVariables("QUERY_STRING")
> strBolum = Split(strURL1,"/")
>
> If strBolum("3") = "Trip_for_Active_Osaka" Then
> Server.Execute("holidays/trip-for-active-osaka.asp")
>
> End If
>
> %>
>
> i alraedy implemented this method mostly on www.cambodia-tourism.org
> If you need help. You can contact me at Cambodia Tourism Site
>
> Teachnology Change the World.



All times are GMT. The time now is 09:53 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.