Credentials lost when posting data

G

Guest

Hi,

I'm trying to send a post to a form on a webserver that requires
credentials. When I log in it works just fine, but when I try to post data to
the webserver the credentials aren't transmitted.

my source:

CredentialCache myCache = new CredentialCache();

webClient.Headers.Add("Content-Type","application/x-www-form-urlencoded");
myCache.Add(new Uri("http://" + ipAdr.Text ),"Basic",new
NetworkCredential("xx","xx"));

webClient.Credentials = myCache;


webClient.UploadValues("http://" + ipAdr.Text +
"/form/newData?protocol=2","POST",isdnOppgrader);


Is this the right way to do it?
I have also tried
myCache.Add(new Uri("http://" + ipAdr.Text +
"/form/newData?protocol=2"),"Basic",new NetworkCredential("xx","xx"));

and
myCache.Add(new Uri("http://" + ipAdr.Text/<the html file that IE uses when
it posts the data> ),"Basic",new NetworkCredential("xx","xx"));


any suggestions?
 
G

Guest

I am wondering has anyone else tried to do this? I am working with a similar issue... trying to login to a web form, by posting the Username and Password fields, but I am not for sure how to do this... I have tried several different ways....
Hi,

I'm trying to send a post to a form on a webserver that requires
credentials. When I log in it works just fine, but when I try to post data to
the webserver the credentials aren't transmitted.

my source:

CredentialCache myCache = new CredentialCache();

webClient.Headers.Add("Content-Type","application/x-www-form-urlencoded");
myCache.Add(new Uri("http://" + ipAdr.Text ),"Basic",new
NetworkCredential("xx","xx"));

webClient.Credentials = myCache;


webClient.UploadValues("http://" + ipAdr.Text +
"/form/newData?protocol=2","POST",isdnOppgrader);


Is this the right way to do it?
I have also tried
myCache.Add(new Uri("http://" + ipAdr.Text +
"/form/newData?protocol=2"),"Basic",new NetworkCredential("xx","xx"));

and
myCache.Add(new Uri("http://" + ipAdr.Text/<the html file that IE uses when
it posts the data> ),"Basic",new NetworkCredential("xx","xx"));


any suggestions

User submitted from AEWNET (http://www.aewnet.com/)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top