Hi Betty,
The article you mentioned is describing a method for url rewriting in
classic asp page. And that method take advantage of the IIS 404 error page.
When the IIS receive a request which doesn't have a valid server document
mapping to it, it will generate a 404 "not found" error, and here we can
configure the IIS to use a custom 404 error page. That means whenever the
client request a non-existing file/page, our custom error page will be
executed. So we can use an asp page as the 404 error page and do our URL
redirection logic there. For creating a custom 404 error page, you can
have a look at the following articles:
#Creating a Custom 404 Error Page
http://www.4guysfromrolla.com/webtech/061499-1.shtml
#How to Create a Custom 404 Error Page in Microsoft IIS
http://ask.enquiro.com/2008/how-to-create-a-custom-404-error-page-in-microso
ft-iis/
So for the following redirect case:
http://www.mydomain.com/param1name/param1value/param2name/param2value/page.a
sp is actuall a url which doesn't even exists on the IIS server, when the
IIS server recieve this request, it will generate 404 error and call our
custom 404 error page(could be an asp page), and in that error page we can
redirect the request to other page(such as the following one) according to
the querystring parameters.
http://www.mydomain.com/page.asp?param1name=param1value
If you still have anything unclear, please feel free to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?YzY3NjIyOA==?= <
[email protected]>
References: <
[email protected]>
Subject: RE: shorten the page address
Date: Tue, 28 Apr 2009 15:42:02 -0700
Steven,
Nice to hear from you again.
I am reading this page:
http://asp.johnavis.com/blog/default.asp?id=19
i don't really understand the following part:
/*****************
Use the following script in your custom error page:
strQuery = Request.ServerVariables("QUERY_STRING")
strPage = Mid(strQuery, InStrRev(strQuery, "/") + 1)
'betty--the above two statements should be
URL=Request.ServerVariables("URL")
strPage = Mid(URL, InStrRev(URL, "/") + 1) 'or did I misunderstand him?
' Change page.asp and page2.asp and add duplicate lines for
' each page you want redirection
If strPage = "page.asp" Then
Response.Status="200 OK"
Server.Transfer("/page.asp")
ElseIf strPage = "page2.asp" Then
Response.Status="200 OK"
Server.Transfer("/page2.asp")
Else '
Put your normal error page here
End If
URL=Request.ServerVariables("URL")
strPage = Mid(URL, InStrRev(URL, "/") + 1)
*****************
In his Funciton RequestQS, is he trying to demo this
http://www.mydomain.com/param1name/param1value/param2name/param2value/page.a
sp page will be
redirected to
http://www.mydomain.com/page.asp?param1name=param1value
I guess I missed something. In order to redirect in this way, does that mean
we need to create a page
param1name/param1value/param2name/param2value/page.asp page, right?
If we have many this kind of pages, we need to create all actual pages?