NetworkCredential

I

IveCal

Hello, guys... What is the Java equivalent class for NetworkCredential?
Please reply. Thanks
 
O

Oliver Wong

Roedy Green said:
wasn't it you in that last post on the futility of making Internet
requests?

Yes. I bet no matter how many times I post the above advice, we'll
always see another user make another multipost.

- Oliver
 
I

IveCal

The code snippet below shows the use of NetworkCredential...
I'm curious over the object (networkCredential in this case) it creates
because it was used once only for authentication purposes... (exactly
before accessing the webpage...) Do you have any idea how is this going
to be implemented in Java? Thanks...

void Page_Load(Object sender, EventArgs e) {
XmlDocument doc = new XmlDocument();
NetworkCredential networkCredential = new
NetworkCredential("username","password"); ==> THIS IS WHAT I MEAN...

HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create(
"http://api.keyworddiscovery.com/free.php?q="
+ HttpUtility.UrlEncode(Request.Form["query"])
);
HttpWReq.PreAuthenticate = true;

HttpWReq.Credentials = networkCredential;

HttpWebResponse HttpWResp =
(HttpWebResponse)HttpWReq.GetResponse();

if (HttpWResp.StatusCode == HttpStatusCode.OK) {
doc.Load(HttpWResp.GetResponseStream());
}

XslTransform trans = new XslTransform();
trans.Load(Server.MapPath("output_template.xsl"));

xml1.Document = doc;
xml1.Transform = trans;
}
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top