feroze
Tue Aug 12 22:57:25 CDT 2003
1) Try the following: ( you did not attach code, so I dont know if you tried
this already )
request.SendChunked = true
request.TransferEncoding = "gzip/deflate"
2) There is no way to reuse the webrequest. you need to create a new
httpwebrequest and set the correct credentials on it.
3) SSL certificate checking happens once per connection establishment. This
is a SSL specification. So, if you chose to ignore the cert error, the
connection gets established. If a subsequent request uses the already
established connection, your handler wont be called. If you want the handler
to be called for every request, you can either a) set KeepAlive = false, b)
use a new connectiongroupname for each request. Both of these will cause a
new connection to be established for each request, which is not very
optimal. Why do you want to be triggered for every request ? Do you expect
something to change on the server between one request and the next ?
feroze.
"EMonaco" <erinmonaco@nospam.net> wrote in message
news:%23gFoxbFYDHA.2464@TK2MSFTNGP09.phx.gbl...
> Rick,
>
> While your document is much better than Microsoft's, it still does not
> answer any of my outstanding questions, of which I will summarize:
>
> 1) Need to gzip post data for transport- having the server gunzip it
before
> persisting data. (ie; transfer-encoding)
>
> Problems here: setting transfer-encoding: says I have to set SendChunked
=
> true. When I do this while adding the header, the .SendChunked property
goes
> back to false (even though HttpWebRequest is shuttled around as (ref). I
> have to explicitly remember it and set it again before calling
> .GetResponse() otherwise I get the same exception as trying to add the
> header.
>
> HTTP 1.1 spec says "chunked" must follow other tokens when using
> "transfer-encoding", so trying to do "Transfer-Encoding: gzip;chunked" I
get
> another exception saying I have to set the Chunked property. Only I didn't
> find a chunked property (I am setting SendChunked=true.
>
> As a test I've just saved the raw form data to a .txt file- using a
> freeware package, I've gzip'd that to form_data.gz, in my post routine I
> read the contents of this .gz file into a byte [] and write that to the
> HttpWebRequest.GetRequestStream() stream.
>
> At last I get a response from the server- but upon checking for the posted
> data- it's blank!
>
> 2) How can I determine at runtime if a URL I'm going to requires a
client
> cert. The only thing I am able to get is the 403 Forbidden? And along
these
> lines- say I send a request and it comes back with 407 Proxy
Authentication,
> what do I need to do exactly to be able to re-use the HttpWebRequest
> instance, setting credentials of course, to resubmit the original request?
>
> 3) I've implemented a class that inherits the ICertificatePolicy
interface.
> I then set ServicePointManager.CertificatePolicy = this. In my
> CheckValidationResult(), I log server cert info and return true. Now say
for
> example, the CN name on the server cert does not match the site name, my
> CheckValidationResult() function is called. After returning true, if I go
to
> the same site- my CheckValidationResult() is not called again. I assume
> because I returned true, and it has cached that information.
>
> My question is can I change this behavior so it will always call my
> CheckValidationResult() on each new request, if there is a cert problem?
> I've checked ServicePointManger and ServicePoint but do not see any method
> that would clear, flush, reset, etc. this information.
>
> Regards,
> Erin.
>
> "Rick Strahl [MVP]" <rickstrahl@hotmail.com> wrote in message
> news:%23PnGHYEYDHA.4040@tk2msftngp13.phx.gbl...
> >
> > Maybe this will help:
> >
> >
>
http://www.west-wind.com/presentations/dotnetWebRequest/dotnetWebRequest.htm
> >
> > This article talks about a lot of non-obvious things that aren't covered
> in
> > the docs.
> >
> > +++ Rick ---
> >
> > --
> >
> > Rick Strahl
> > West Wind Technologies
> >
http://www.west-wind.com/
> >
http://www.west-wind.com/wwHelp
> > ----------------------------------
> > Making waves on the Web
>
>