AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

"NetworkCredential"

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
IveCal
Guest





PostPosted: Mon Apr 17, 2006 6:12 am    Post subject: "NetworkCredential" Reply with quote



Hello, guys... What is the Java equivalent class for C# class
"NetworkCredential"? Please reply. .Thanks
Back to top
Oliver Wong
Guest





PostPosted: Mon Apr 17, 2006 5:12 pm    Post subject: Re: "NetworkCredential" Reply with quote



"IveCal" <ive.cal (AT) gmail (DOT) com> wrote in message
news:1145252105.787400.239240 (AT) u72g2000cwu (DOT) googlegroups.com...
Quote:
Hello, guys... What is the Java equivalent class for C# class
"NetworkCredential"? Please reply. .Thanks

I couldn't find the "NetworkCredential" class. Did you perhaps mean the
System.Net.ICredentials interface?

There isn't nescessarily a one to one correspondence between C# classes
and Java classes. You'll probably get more answers if you explain the
problem you're trying to solve, and ask questions indicating where you're
stuck.

- Oliver
Back to top
Roedy Green
Guest





PostPosted: Mon Apr 17, 2006 7:12 pm    Post subject: Re: "NetworkCredential" Reply with quote



On 16 Apr 2006 22:35:05 -0700, "IveCal" <ive.cal (AT) gmail (DOT) com> wrote,
quoted or indirectly quoted someone who said :

Quote:
Hello, guys... What is the Java equivalent class for C# class
"NetworkCredential"? Please reply. .Thanks

I am not familiar with C#, but the name suggests you might look at
http://mindprod.com/jgloss/authentication.html
or possibly
http://mindprod.com/jgloss/ssl.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Back to top
IveCal
Guest





PostPosted: Thu Apr 20, 2006 7:12 am    Post subject: Re: "NetworkCredential" Reply with quote

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;
}
Back to top
Oliver Wong
Guest





PostPosted: Thu Apr 20, 2006 3:12 pm    Post subject: Re: "NetworkCredential" Reply with quote

"IveCal" <ive.cal (AT) gmail (DOT) com> wrote in message
news:1145515682.514898.187790 (AT) i40g2000cwc (DOT) googlegroups.com...
Quote:
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;
}

Looks like it's doing HTTP authentication. Try:

http://java.sun.com/j2se/1.5.0/docs/api/java/net/Authenticator.html

and

http://java.sun.com/j2se/1.5.0/docs/api/java/net/PasswordAuthentication.html

- Oliver
Back to top
IveCal
Guest





PostPosted: Wed Apr 26, 2006 2:12 am    Post subject: Re: "NetworkCredential" Reply with quote

Thanks a lot MR. Oliver Wong... Thanks...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.