Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help: need to write a simple ISAPI filter to redirect to another URL

70 views
Skip to first unread message

Joe Bloggs

unread,
Aug 16, 2006, 2:34:57 AM8/16/06
to
Hi all,

I am trying to write an ISAPI filter to redirect all traffic to
oanother URL, but I kept getting a strange error message from IIS:

in the OnPreprocHeader, I simply set the header to contain the
redirectedURL and return the SF_STATUS_REQ_NEXT_NOTIFICATION. However,
I kept getting this error message:
HTTP 414 - Request - URI Too Long

See the code snipplet below:
-----------

DWORD COutageRedirectorFilter::OnPreprocHeaders(CHttpFilterContext*
pCtxt,
PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
{

char * redirectURL = "http://www.microsoft.com.au";

pHeaderInfo->SetHeader(pCtxt->m_pFC, "url", redirectUrl);


//we want to leave this alone and let IIS handle it.
// return this status code if not redirection is required.
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}

What could be the problem? What is the right way to do a redirection?

Thanks

David Wang [Msft]

unread,
Aug 16, 2006, 3:50:30 AM8/16/06
to
Please read this blog entry and clarify what sort of redirection you want to
perform.
http://blogs.msdn.com/david.wang/archive/2005/08/01/HOWTO_Common_URL_Redirection_Techniques_for_IIS_Summary.aspx

Your ISAPI Filter code definitely has problems, but let's first determine
what the filter *should* be doing, then worry about how it is implemented in
code.

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

"Joe Bloggs" <es...@rocketmail.com> wrote in message
news:1155710096.9...@p79g2000cwp.googlegroups.com...

Joe Bloggs

unread,
Aug 16, 2006, 4:19:46 AM8/16/06
to
Hi David,

I have read your blog, what I needed to do is essentially doing is
using an ISAPI Filter to perform a server side redirection, in which
case, I believe is to set the request Header "url" variable.

Can you kindly show me in code how this can be done. Thanks.

David Wang [Msft]

unread,
Aug 16, 2006, 6:02:18 PM8/16/06
to
http://www.anotherserver.com is not a valid URL for server side redirection.
Can you clarify what you actually want to do.

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

"Joe Bloggs" <es...@rocketmail.com> wrote in message

news:1155716386.1...@h48g2000cwc.googlegroups.com...

0 new messages