Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTPGetRequest and Credentials

Status
Not open for further replies.
Jul 29, 2005
136
PT
Hi,

I´m trying to make an HTTP request to a web site with Integrated windows authentication security.

To pass the credentials I use this code:

Dim MyCredentialCache = New System.Net.CredentialCache
MyCredentialCache.Add(New System.Uri(sURL), "NTLM", _
New System.Net.NetworkCredentia("user", "pass", "domain"))

and then:

HTTPGetRequest.Credentials = MyCredentialCache


However, this is not working. In the IIS log at the computer I´m trying to reach, I can see the credentials are not being send, and so I see a 401 error. I don´t get this error on the client though (it ends with a timeout error).

I´m using VS2005.

Thank you
 
olisemails: can't answer this specifically but just a thought -- do a search at Google "Groups" with the Error code and see what you bring up - if you have disregard this - just a thought that might help you along.
 
Hello,

I fallowed your advince. A got a lot of errors as mine, however, my client is not re-requesting when the server throws an 401 error. So, I guess this is why the credentials are not being passed... there is no second request. How come? I have set keepalive to true...

Thank you
 
olisemalis: This is a good post for where to turn when details such as this are difficult to unravel. Perhaps one of the Programmers here with more experience can drop in and help guide you in your research and/or answer your question regarding the lack of a second request. You might refine your search and seek out technical sites that are more server oriented, etc.. I wish I could help you further but I would be in the same position as yourself. Do you have anyone else available who may help in server support? In my situation I work on a University server and from time to time email the gurus there for guidance. Post back and keep us informed on your progress - again; someone may drop by here and help guide you in your research efforts on this problem. Good Luck.
 
olisemalis: Try various strings in your Google Groups search and do not restrict it to the just the error message -- for example, use "System.Net.CredentialCache" and "HTTPGetRequest", etc. Make sure too that you use the advance feature and select responses that are not but a year or two old.
 
Just a thought if you have control of the requested site.
You can use IIS to require window authenticated users or use the Web.config.

In iis check to allow anonymous access and try the web.config method in place of that.

<authorization>
<deny users="?" />
</authorization>
 
Hello,

This is a web service accessed via ur (to the default web page consumption of the web service). This web service will be responsible for a call to another asp application in another computer. The asp folder only have some files that I need to get.

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top