• Welcome to Valhalla Legends Archive.
 

ISAPI Filter for URL Rewriting

Started by MyndFyre, May 03, 2006, 08:43 PM

Previous topic - Next topic

MyndFyre

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!
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

UserLoser


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.

Maddox

Wow, you could do this in one line in .htaccess with apache.
asdf.

MyndFyre

Quote from: Maddox on June 05, 2006, 05:09 AM
Wow, you could do this in one line in .htaccess with apache.

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.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.