urlmap的简单问题,在线送分
我作了一个url map的测试dll,根据MS提供的代码稍微作了修改,url跳转是没有问题了,但是地址栏上的url也换了。怎么让它网页跳转但是url还是我输入的url?
//source code:
DWORD CURL_reWriteFilter::OnUrlMap(CHttpFilterContext* pCtxt,
PHTTP_FILTER_URL_MAP pMapInfo)
{
CHAR szRedirect [256];
bool bflag = false;
if (strstr (pMapInfo->pszURL, "Index/"))
{
//CHAR szRedirect [256];
// replace www.microsoft.com with desired server
if(strstr(pMapInfo->pszURL,"2.html"))
{
sprintf(szRedirect, "Location: http://%s\r\n\r\n", "10.16.50.12:9000/index.asp?page=2");
bflag = true;
}
if(strstr(pMapInfo->pszURL,"3.html"))
{
sprintf(szRedirect, "Location: http://%s\r\n\r\n", "10.16.50.12:9000/index.asp?page=3");
bflag = true;
}
if(strstr(pMapInfo->pszURL,"4.html"))
{
sprintf(szRedirect, "Location: http://%s\r\n\r\n", "10.16.50.12:9000/index.asp?page=4");
bflag = true;
}
if(!bflag)
{
sprintf(szRedirect, "Location: http://%s\r\n\r\n", "10.16.50.12:9000/index.asp?page=1");
}
pCtxt->ServerSupportFunction ( SF_REQ_SEND_RESPONSE_HEADER,
(LPVOID) "302 Redirect",
(DWORD *) szRedirect,
0 );
// Print a message to the debug window
//ISAPITRACE1 ("Redirecting to: %s\n", szRedirect);
// we are done with this request
// return SF_STATUS_REQ_FINISHED_KEEP_CONN;
return SF_STATUS_REQ_HANDLED_NOTIFICATION;
}
// URL did not contain a DoRedirect string.
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
现在的效果是:我输入:http: //localhost/Index/2.html,网页直接跳转到http://10.16.50.12:9000/index.asp?page= 2,希望的效果是url上显示仍然是我输入的:“http://localhost/Index/2.html”,显示内容为:“http: //10.16.50.12:9000/index.asp?page=2”,应该怎么实现?
os: winxp sp2