This code snippet is part of an isapi redirect filter written in managed c++ that will capture url requests with prefix "http://test/. Once the url is captured it will redirect those request to a test.aspx file i have at the root of my web app.
I need some syntax help how to:
1) pass the "urlString" parameter to be displayed in my "test.aspx" page. Problem line: urlString.Replace(urlString, "/test.aspx?urlString");
2) syntax for my aspx page to display urlString
DWORD CRedirectorFilter::OnPreprocHeaders(CHttpFilterContext* pCtxt,
PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
{
char buffer[256];
DWORD buffSize = sizeof(buffer);
BOOL bHeader = pHeaderInfo->GetHeader(pCtxt->m_pFC, "url", buffer, &buffSize);
CString urlString(buffer);
urlString.MakeLower(); // for this exercise
if(urlString.Find("/test/") != -1) //insert url condition
{
urlString.Replace(urlString, "/test.aspx?urlString");
char * newUrlString= urlString.GetBuffer(urlString.GetLength());
pHeaderInfo->SetHeader(pCtxt->m_pFC, "url", newUrlString);
return SF_STATUS_REQ_HANDLED_NOTIFICATION;
}
//we want to leave this alone and let IIS handle it
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
-------------- aspx page
<html>
<body>
<%
dim url as string = request.querystring("urlString")
response.write(url)
%>
</body>
</html>