Brian
Sat Jul 03 19:27:01 CDT 2004
Well thanks Jakob and Feroze - with this information I managed to get both
methods working.
The WebClient method does not seem to pass the Cookie information (used to
keep the login context) between pages so I ended up using the Cookie
properties in HttpWebRequest and HttpWebResponse to do this.
Thanks,
Brian
"feroze [msft]" <ferozed@online.microsoft.com> wrote in message
news:40e3ac62$1@news.microsoft.com...
> If all you want to do is post to a form, just use WebClient. It has an
> UploadValues method, which will do the right thing for you.
>
> feroze
> ===========
>
> "Brian Taylor" <taylorb@newsgroups.nospam> wrote in message
> news:%23kR7hMyXEHA.2520@TK2MSFTNGP12.phx.gbl...
> > Thanks Jakob this look just what I need. I'll give it a go and post any
> > further problems if I get them.
> >
> > Brian
> >
> >
> > "Jakob Christensen" <jchREMOVE@pension.dk> wrote in message
> > news:E6D390F3-5F5C-4CAE-8318-932E6C5EAB4C@microsoft.com...
> > > Hey Brian,
> > >
> > > Use the HttpWebRequest class to make HTTP requests. Use the property
> > HttpWebRequest.Method to specify that you wish to use HTTP POST. After
> > that you can use the HttpWebRequest.GetRequestStream method to retrieve
a
> > stream to which you can write the post data such as username and
password.
> > Check the HTML of the web site to see the names of the input fields for
> the
> > username and password.
> > >
> > > See the docs for a short example:
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
> > frlrfsystemnethttpwebrequestclassgetrequeststreamtopic.asp
> > >
> > > Regards, Jakob.
> > >
> > >
> > > "Brian Taylor" wrote:
> > >
> > > > I am trying to get some data from a web site that has form-based
> > > > authentication (username/password with submitt button).
> > > >
> > > > So I just need to write software to go to the URL, enter the
username
> > and
> > > > password and download the information from the resulting page.
> > > >
> > > > Does anyone know how to do this - that is entering the username and
> > > > password?
> > > >
> > > > (I can tried to add CredentialCache object to a WebRequest but I
think
> I
> > > > need to somehow Post the username and password information to the
> page.)
> > > >
> > > > Brian
> > > >
> > > >
> > > >
> >
> >
>
>