Re: [Pi3web-users] redirection
Brought to you by:
zimpel
From: Dharmesh S. <for...@ho...> - 2004-02-27 18:53:43
|
Hello Holger, After evaluating all the options - doing a internal redirect to a html page is what will get my job done. Thanks for all the help. I am still fighting a one issue: After settingup my ISPAI filter 'UPCASE' in Features.pi3 and adding it to HANDLERS of HTTPLogicObject..... and changing Init & Headers COMPLETED to CONTINUE..... in START Object The file features.pi3 is attached for your reference..... The notify event SF_NOTIFY_PREPROC_HEADERS is received by the filter. We are successful in extracting 'url' string also via GetHeader. But even after SetHeader - pi3web still process the original url request and not modified url request. Please help. Thanks again for all the help. For your reference - code looks like this..... The code for redirection is similar to one on www.codeproject.com/ispai/ispairedirector.asp page //case SF_NOTIFY_PREPROC_HEADERS: 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("dharmesh") != -1) //we want to redirect this file { urlString.Replace("dharmesh","redirect"); 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; //break; Thanks & Regards, Dharmesh ----Original Message Follows---- From: zi...@t-... (Holger Zimmermann) To: Dharmesh Shah <for...@ho...> CC: pi3...@li... Subject: Re: [Pi3web-users] External redirection Date: Thu, 26 Feb 2004 08:00:13 +0100 Hello Dharmesh, external redirection can be done in several different ways : - by embedding the related tag in a (static) HTML page (this is a pure browser mechanism, the server isn't involved at all), e.g.: <head> <meta http-equiv="refresh" content="0; URL=http://foo.org/bar/"> </head> - in Pi3Web 2.0.2 using the Redirection PathMapper (administration), this results, e.g., in the following configuration directive : Mapping RedirectMapper From="/pi3site/" \ To="http://pi3web.sourceforge.net/" - in the configuration by adding a flexible handler, which (conditionally) adds the correct response header in order to trigger redirection (configuration). - using one of the available features to generate dynamic contents, e.g. CGI, SSI, PHP, ISAPI, ASP, Servlet, JSP, PSP (programming), e.g. as PHP page : <? header("Location: http://foo.org/bar"); ?> Some Remarks : In each case, the response of the server should look like : HTTP/1.0 302 Permanently Moved NL Location: http://foo.org/bar NL NL NL - 'NL' indicates a new line. You must not care about it, if the headers are generated by the respective server functions (exception: NPH-CGI programs - i.e. 'Non Parsed Headers', these are produced by CGI's, which write the complete response message, including the status line and all headers into the output stream). - The URL to which the browser shall be re-located must be complete, because the redirection is done by the browser and not within the server ( schema://[host.]domain.extension/path[/resource?params] ) -- regards, Holger Dharmesh Shah schrieb: > >Hello Holger, > >Thanks for the feedback. >I will explore using - SF_NOTIFY_PREPROC_HEADERS. >Any hints/leads for external (via the browser, location of the target e.g. >at another web server) redirect. > >Thanks, > >Dharmesh > >----Original Message Follows---- >From: zi...@t-... (Holger Zimmermann) >To: Dharmesh Shah <for...@ho...> >CC: pi3...@li... >Subject: Re: [Pi3web-users] Help on ISAPI Filter for SF_NOTIFY_URL_NOTIFY >Date: Wed, 25 Feb 2004 19:44:41 +0100 > >Hello Dharmesh, > >do you want to perform an internal (URL with physical location of the >target within the server) or an external (via the browser, location of the >target e.g. at another web server) redirect? For the first case refer to >this link: http://www.codeproject.com/isapi/isapiredirector.asp > >In this MFC-example they catch SF_NOTIFY_PREPROC_HEADERS events and simply >change the URL. This is done, before the server processes the headers, i.e. >maps the URL to a physical resource path. > >(I don't know, if the following is necessary, but in order to get >SF_NOTIFY_URL_MAP events you must invoke the filter DLL prior the Pi3Web >handler object, which completes the mapping phase, this is per default the >'Start' object. Or you must supress the completion of the 'Mapping' phase >by the handlers invoked prior the filter. >This is the way, how Pi3Web handles processing of the separate request >phases: Each handler configured in the server logic object will be called, >until one sets the status of the processing of the phase to 'completed'.) >-- >regards, >Holger > >Dharmesh Shah schrieb: > _________________________________________________________________ Marriage? Join BharatMatrimony.com. http://www.bharatmatrimony.com/cgi-bin/bmclicks1.cgi?74 |