Valhalla Legends Forums Archive | C/C++ Programming | ISAPI Filter for URL Rewriting

AuthorMessageTime
Myndfyr
Hey.

I'm trying to write a quick-and-dirty ISAPI filter for IIS URL rewriting, to simulate the Wikipedia URL formatting.  I want to make sure I'm doing the right thing.

On IIS, the URL for a MediaWiki installation typically looks like this:

http://host/optional-wiki-subfolder/index.php?title=article-name

...and so I want to translate that to:

http://host/optional-wiki-subfolder/article-name

In the derived class, I'm overwriting CHttpFilter::OnUrlMap.  Is that right?

Also, I need to make sure that the URL is not rewritten if a directory exists under my main application path with what would be the article name.  So far I have /forum, and I'm planning on adding /pub. 

Is there a convenient way to enumerate folders under an IIS virtual path?  Do I just use the Win32 API?  Or, since I'm using MFC, is there an even more convenient way?  :)

Thanks!
May 4, 2006, 1:43 AM
UserLoser
Ew, MFC.

</useless post>
May 4, 2006, 7:27 AM
Skywing
Responded to this via MSN last night, but for the benefit of everyone else:

The answer should be to use GetServerVariable to query the PATH_TRANSLATED variable and operate on that.  For ISAPI extensions (and not filters), you can use ServerSupportFunction with HSE_REQ_MAP_UNICODE_URL_TO_PATH.
May 5, 2006, 11:05 PM
Maddox
Wow, you could do this in one line in .htaccess with apache.
June 5, 2006, 10:09 AM
Myndfyr
[quote author=Maddox link=topic=14928.msg153833#msg153833 date=1149502197]
Wow, you could do this in one line in .htaccess with apache.
[/quote]

Yes, I know, thank you.  Unfortunately for other reasons I am not using Apache.  That is why I wanted to know what a solution could be using MFC.
June 5, 2006, 10:05 PM

Search