Re: Alter querystring through APP



On Oct 26, 11:55 am, "Igor Tandetnik" <itandet...@xxxxxxxx> wrote:
Max K. <ma...@xxxxxxxxxxxxx> wrote:
While using Igor's Passthru APP I need to add a querystring to a
requested url.
In my Start() method I am appending the querystring to szUrl
parameter and calling target app's Start() method with the new URL
with querystring. The request gets sent with the new url.

STDMETHODIMP CTestAPP::Start(
LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink,
IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)

{
LPCWSTR szUrlQuery = szUrl + querystring //add querystring to url

This is pseudocode, right? It doesn't make sense as actual code.


Correct. This is pseudocode. Sorry I did not point it out.



targetApp -> Start(szUrlQuery, ...) //call target app's start with new
url
}

In my ReportData() method my App calls targetSink's ReportProgress
method with BINDSTATUS_REDIRECTING flag with the new URL (szUrlQuery)
to notify the request URL had been changed.

STDMETHODIMP CTestSink::ReportData(
/* [in] */ DWORD grfBSCF,
/* [in] */ ULONG ulProgress,
/* [in] */ ULONG ulProgressMax)
{

m_spInternetProtocolSink->ReportProgress(BINDSTATUS_REDIRECTING,
szUrlQuery); //notify redirect with new URL with querystring

Move that to Start, right before calling Start on target APP. ReportData
is called multiple times, you don't want to report
BINDSTATUS_REDIRECTING more than once.

m_spInternetProtocolSink->ReportData((BSCF_FIRSTDATANOTIFICATION |
BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE), dwLegth,
dwLegth); //notify target sink of data

You tell the client that data is fully avaialble. Is it? How do you know
it is? What makes you so sure the target APP will give you all the data
in one big chunk? Why don't you just pass along the same parameters you
got?

hr = m_spInternetProtocolSink->ReportResult(S_OK, S_OK, NULL);

Same question - when the first ReportData arrives, what makes you so
sure the result is going to be OK? That the connection won't get dropped
before the next chunk of data makes it to you?


I checked all of that before. My App calls target
ReportProgress(BINDSTATUS_REDIRECTING), ReportData(), ReportResult()
only once. This is just pseudocode.



However, when I submit the form, that is suppose to request the same
URL+ querystring, the browser sends to APP a request without the
querystring. Why does this happen?

POST requests don't encode form parameters into the URL, but send them
as POST data. What does the <form> tag look like for the form you are
submitting? In particular, what is the method= attribute set to?

In my case I have an empty form, with method = POST and action is
blank. It means that it has to send an empty POST request to the same
URL + querystring that was on the address bar. Correct?


If I ignore this problem and have my APP add the querystring to the
URL on the second request

What do you mean by "second request"? I assume there's also a "first"?
How do the two differ?

The first was initiated by typing URL in Browser address bar. The
second request was hitting submit on the form returned by the first
request.

--
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- Hide quoted text -

- Show quoted text -

My general question: is it possible for the APP to change URL after
request was initiated by browser? In my test described above I was
only able to change the URL for 2 consecutive requests and then on the
3-rd request the browser stopped working.

.



Relevant Pages

  • Re: Alter querystring through APP
    ... In my Startmethod I am appending the querystring to szUrl ... The request gets sent with the new url. ... In my ReportData() method my App calls targetSink's ReportProgress ... right before calling Start on target APP. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: BUG? With A HTTPModule
    ... querystring is specified but encountered 404 error if request the url ... I tried visit some pages (which is in the root folder of the application) ... both with querystring and without any querystring but seems not encounter ...
    (microsoft.public.dotnet.framework.aspnet)
  • Alter querystring through APP
    ... In my Startmethod I am appending the querystring to szUrl ... The request gets sent with the new url. ... In my ReportDatamethod my App calls targetSink's ReportProgress ... the browser sends to APP a request without the ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: HttpWeb Request from Class Library fails to 500
    ... I also used IE UserAgent string. ... querystring that you pass. ... > I agree with Joerg, since the IIS server has received the request, it is ... > some further detailed info on the asp.net page you request... ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: adding an item to a QueryString
    ... > It doesn't really make a lot of sense to change a property of a request ... the site use a different stylesheet if "Mode2" is in the Querystring. ... present in the referrer, the value could be propagated at a high level, ...
    (microsoft.public.dotnet.framework.aspnet)

Loading