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

       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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you will need to use a URL re-write ISAPI filer that will convert each inbound request.

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
     ' 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"


copy paste this into your favorit editor...

Best regards

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
excellent solution xaungxaj.....
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

iamkarthkAuthor Commented:
ThanX Xaungxaj
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.