?
Solved

IIS- how 2 auto-redirect mypage.htm to mypage.asp?

Posted on 2003-03-17
5
Medium Priority
?
563 Views
Last Modified: 2010-08-05
       I have over 40 .htm files and many cross links. I did a rename *.htm *.asp and now many links dont work.
I am including ASP code in each file to allow access. I dont want to go and replace htm with asp in each file.

        So i was wondering if there was a way to use IIS 5.0 (Windows 2000) to automatically load the corresponding asp file instead of the htm file?
0
Comment
Question by:iamkarthk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:makerp
ID: 8158264
you will need to use a URL re-write ISAPI filer that will convert each inbound request.

http://search.yahoo.com/bin/search?p=ISAPI+url+re+write
0
 

Accepted Solution

by:
xaungxaj earned 200 total points
ID: 8185702
You could make a custom 404 error page (this page is beeing loaded if IIS cant find the requested file).

<%
     'save this to file in the siteroot as 404.asp and configure your IIS to use for 404 errors.
     'righthclick the site name- >choose properties->cusomt errors.
     'scroll down the list until you find 404. Mark it and push Editproberties
     'Change the messageType to URL and the URL valuefield to /404.asp
     
     dim newFilename
     
     newFileName=request.ServerVariables("QUERY_STRING")
     ' the querystring counld hold something like this
     ' 404;http://www.xxxxxx.xxx/tools/test.asp3
     
     'First remove the noise (404;http://)
     newFilename = replace(newFilename, "404;http://", "")
     
     ' findout which filethat was requested
     newFilename = right(newFilename, instr(newFilename,"/")-1)
     
     'find the last period in the filename
     newFileName = left(newFileName,instrRev(newFilename, "."))
     
     'brew the new filename
     newFileName =newFileName & "htm"
     server.transfer(newFilename)



%>

copy paste this into your favorit editor...

Best regards
Magnus
0
 
LVL 10

Expert Comment

by:makerp
ID: 8185767
excellent solution xaungxaj.....
0
 

Expert Comment

by:xaungxaj
ID: 8189342
Thanks...
Downside of the medal is that it will mess up the logfiles with a lot of 404 errors.

I've been looking for some urlrewritters myself.
I found this one which happens to be free too. That is if you doen't have to put different configurations for different sites. http://www.isapirewrite.com/

This one have the utilliy to "not mangle" with the log files...
Meaning if someone request xxx.sddsfds.xxx/folder1/folder1_2
then that is what that will be recorded in the logfile.
eventhough it's another file handling the request

Magnus
0
 

Author Comment

by:iamkarthk
ID: 8198065
ThanX Xaungxaj
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question