Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Tue, 21 Aug 2007 13:58:18 -0000,    group: microsoft.public.inetsdk.programming.urlmonikers        back       


Preventing Redirect with URL Moniker   
Greetings,

Does anyone happen to know of a method to prevent redirects from going
through? I do not want to allow the redirect to happen automatically.
Aborting the page seems to display a navigation error when using
Abort. This presents a problem, as I do want the actual page of data
returned from the server, even if that page simply states "The page
you are looking for is located elsewhere."

Currently, I've implemented:

IInternetProtocol, IInternetBindInfo, IInternetProtocolSink,
IHttpSecurity

In ReportProgress(), I am able to see that ulStatusCode contains
BINDSTATUS_REDIRECTING, and BINDSTATUS_SENDINGREQUEST. Abort() does
not seem to prevent the redirect and maintain current page contents.
Is there another method to just ignore automatic redirect following?

Thanks in advance,
Michael
date: Tue, 21 Aug 2007 13:58:18 -0000   author:   unknown

Re: Preventing Redirect with URL Moniker   
Although after further investigation, it appears as though
implementing IHttpNegotiate and returning E_ABORT in either
OnResponse() when dwResponseCode is a redirect code may do the trick.
Any insight on this before moving in that direction?
date: Tue, 21 Aug 2007 14:09:16 -0000   author:   unknown

Re: Preventing Redirect with URL Moniker   
michael.martinek@gmail.com wrote:
> Does anyone happen to know of a method to prevent redirects from going
> through? I do not want to allow the redirect to happen automatically.
> Aborting the page seems to display a navigation error when using
> Abort. This presents a problem, as I do want the actual page of data
> returned from the server, even if that page simply states "The page
> you are looking for is located elsewhere."
>
> Currently, I've implemented:
>
> IInternetProtocol, IInternetBindInfo, IInternetProtocolSink,
> IHttpSecurity

I'm not sure I understand. Are you using an APP handler, or implementing 
one?

In case you are using a built-in HTTP handler, try the following. When 
passing along BINDINFO, add BINDINFO_OPTIONS_WININETFLAG bit to 
BINDINFO::dwOptions, and set dwOptionsFlags to 
INTERNET_FLAG_NO_AUTO_REDIRECT. The HTTP handler will pass this along to 
WinInet calls. I've never tried it though, I'm not sure how it would 
work out.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Tue, 21 Aug 2007 11:03:51 -0400   author:   Igor Tandetnik

Re: Preventing Redirect with URL Moniker   
> I'm not sure I understand. Are you using an APP handler, or implementing
> one?

It is indeed an APP, but I'm using Delphi so I have the fun of
developing one from the ground up because none currently exist (In
Delphi) that work properly, or support everything I need for my
application.

> In case you are using a built-in HTTP handler, try the following. When
> passing along BINDINFO, add BINDINFO_OPTIONS_WININETFLAG bit to
> BINDINFO::dwOptions, and set dwOptionsFlags to
> INTERNET_FLAG_NO_AUTO_REDIRECT. The HTTP handler will pass this along to
> WinInet calls. I've never tried it though, I'm not sure how it would
> work out.

This was a great idea. Unfortunately, it didn't prevent automatic
following of redirects.

function TInetHandler.GetBindInfo(out grfBINDF: DWORD; var bindinfo:
TBindInfo): HResult; stdcall;
const
  BINDINFO_OPTIONS_WININETFLAG          = $00010000;
  BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS = $40000000;
  INTERNET_FLAG_NO_AUTO_REDIRECT        = $00200000;
begin
  Result := FBindInfo.GetBindInfo(grfBINDF, bindinfo);

  bindinfo.dwOptions := bindinfo.dwOptions or
BINDINFO_OPTIONS_WININETFLAG;
  bindinfo.dwOptionsFlags := bindinfo.dwOptionsFlags or
INTERNET_FLAG_NO_AUTO_REDIRECT;
end;

The way I'm setting this up is that when my Start() is called, I call
the default protocol handler's Start() and pass my implementation as
the IInternetProtocolSink and IInternetBindInfo parameters of the
default protocol handler's Start(). This successfully has me
intercepting data and modifying values at will, and I can confirm that
my GetBindInfo() is being called and is modifying the values before
returning them to the default protocol handler. FBindInfo is the
original IInternetBindInfo that was passed on the Start() to my APP.
date: Tue, 21 Aug 2007 15:52:18 -0000   author:   unknown

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us