WinHttp Object - Viewing the Request
am 01.10.2007 18:59:23 von Dominic
Hello,
I'm using the WinHttp.WinHttpRequest.5.1 object (IIS 6) with classic
ASP.
I can view the response headers using the .GetAllResponseHeaders
method.
How do I view the Request headers? Is this at all possible because I
can't find anything here http://msdn2.microsoft.com/en-us/library/aa384106.aspx
?
Thanks, Dominic
Re: WinHttp Object - Viewing the Request
am 01.10.2007 19:30:10 von David Wang
On Oct 1, 9:59 am, Dominic wrote:
> Hello,
>
> I'm using the WinHttp.WinHttpRequest.5.1 object (IIS 6) with classic
> ASP.
>
> I can view the response headers using the .GetAllResponseHeaders
> method.
>
> How do I view the Request headers? Is this at all possible because I
> can't find anything herehttp://msdn2.microsoft.com/en-us/library/aa384106.aspx
> ?
>
> Thanks, Dominic
You can use the ALL_RAW ServerVariable on the ASP page to view the
request headers.
Personally, I use a Network Sniffer to independently validate the
request and response data. Don't trust the system you are using.
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
Re: WinHttp Object - Viewing the Request
am 01.10.2007 20:02:30 von Dominic
> You can use the ALL_RAW ServerVariable on the ASP page to view the
> request headers.
Doesn't that give the the ALL_RAW value for the page I'm on, not
what's send by the winHttp object?
For example, I can use ObjWinHttp.SetRequestHeader to change the "User-
Agent" of the request. If I view the server variables my "User-Agent"
is 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
2.0.50727; .NET CLR 3.0.04506.30)' not what I've changed it to.
Re: WinHttp Object - Viewing the Request
am 02.10.2007 02:00:21 von David Wang
On Oct 1, 11:02 am, Dominic wrote:
> > You can use the ALL_RAW ServerVariable on the ASP page to view the
> > request headers.
>
> Doesn't that give the the ALL_RAW value for the page I'm on, not
> what's send by the winHttp object?
>
> For example, I can use ObjWinHttp.SetRequestHeader to change the "User-
> Agent" of the request. If I view the server variables my "User-Agent"
> is 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
> 2.0.50727; .NET CLR 3.0.04506.30)' not what I've changed it to.
Correct. ALL_RAW returns what the client sent on accessing that ASP
page.
Since you said you are using WinHttp in an ASP application and want to
know what was sent on the request by WinHttp, I assume you can change
the URL of that request to temporarily point to an ASP page which can
use ALL_RAW to capture the request header sent by WinHttp.
Otherwise, if the API does not give a way to enumerate the request to
be sent, you're just out of luck and have to do something else, like
sniff the network traffic, which would work unless traffic is over
SSL, or temporarily divert the WinHttp request to an ASP page (which
works with SSL but disturbs business logic).
If you're looking for some knob to turn on tracing, it doesn't exist.
You'll have to write in the tracing yourself to debug between the
layers.
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//