473,785 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do NetworkCredenti al and WebClient work?

I read many examples with NetworkCredenti al and WebClient, but no one
with a real http address.
They all work in theory, but I wasn't able to use them in the real
world.
The following code should access an ebay page. There is no
redirection involved in TestPage. If you have an ebay account you can
try it in 1 minute.

What's wrong with my code?

Dim UserName As String = "stenci"
Dim Password As String = "vivalafica "
Dim TestPage As String = _
"http://my.ebay.com/ws/eBayISAPI.dll?M yeBay&MyeBay=" _
& UserName
Dim Cli As New Net.WebClient

Dim Txt1 = Cli.DownloadStr ing(TestPage)
IO.File.WriteAl lText("C:\1.txt ", Txt1)

Cli.Credentials = New Net.NetworkCred ential(UserName , _
Password)

Dim Txt2 = Cli.DownloadStr ing(TestPage)
IO.File.WriteAl lText("C:\2.txt ", Txt2)

MsgBox("Before setting credentials is not logged=" & _
InStr(Txt1, "Sign In: My eBay") & " is logged=" _
& InStr(Txt2, "Sign In: My eBay"))

MsgBox("After setting credentials is not logged=" & _
InStr(Txt1, "My Summary") & " is logged=" _
& InStr(Txt2, "My Summary"))

Thanks,
Stefano

Feb 4 '07 #1
2 2693
On Feb 4, 6:15 pm, "Tosco" <stefano.me...@ gmail.comwrote:
I read many examples with NetworkCredenti al and WebClient, but no one
with a real http address.
They all work in theory, but I wasn't able to use them in the real
world.
The following code should access an ebay page. There is no
redirection involved in TestPage. If you have an ebay account you can
try it in 1 minute.

What's wrong with my code?

Dim UserName As String = "stenci"
Dim Password As String = "vivalafica "
Dim TestPage As String = _
"http://my.ebay.com/ws/eBayISAPI.dll?M yeBay&MyeBay=" _
& UserName
Dim Cli As New Net.WebClient

Dim Txt1 = Cli.DownloadStr ing(TestPage)
IO.File.WriteAl lText("C:\1.txt ", Txt1)

Cli.Credentials = New Net.NetworkCred ential(UserName , _
Password)

Dim Txt2 = Cli.DownloadStr ing(TestPage)
IO.File.WriteAl lText("C:\2.txt ", Txt2)

MsgBox("Before setting credentials is not logged=" & _
InStr(Txt1, "Sign In: My eBay") & " is logged=" _
& InStr(Txt2, "Sign In: My eBay"))

MsgBox("After setting credentials is not logged=" & _
InStr(Txt1, "My Summary") & " is logged=" _
& InStr(Txt2, "My Summary"))

Thanks,
Stefano
did you just post your ebay password on the internet?

Feb 4 '07 #2
"Tosco" <st***********@ gmail.comschrie b:
>I read many examples with NetworkCredenti al and WebClient, but no one
with a real http address.
eBay uses a different authentication approach similar to those used by
Google:

<URL:http://dotnet.mvps.org/dotnet/code/net/#CookieRequest>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
13304
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileID.ToString() + ".pdf");
7
3944
by: Crirus | last post by:
Hi all! I use a webClient for requesting data from a server of mine. Should I worry about long ammount of data sent by server in the client side? Or, another way, should I send some kind of a terminator sign in the data in order to realise in the client that all data arrived? -- Ceers, Crirus
3
6933
by: Patrick Fogarty | last post by:
I am programming what is to be a web service client that will use an HTTP-POST to request and retrieve data. The remote server (written in java for what it's worth) requires basic authentication as per RFC 2617 (http://www.faqs.org/rfcs/rfc2617.html). My attempts to authenticate are failing. The server requires the header to be present with the request. For security reasons, it will not reply in any way if the header is not present. ...
6
22105
by: Giovanni | last post by:
Hi Guys, Really strange problem I am experiencing... I have setup a virtual directory with Read Only permissions on an ISA/IIS server (SBS 2003). In that virt. dir., I placed 1 file (setup.exe). I then use WebClient.DownloadFileAsync (.NET 2.0 Pro.) and all downloads well including progress bar indicator, bytes received, etc... Here is the problem: When I replace the file (setup.exe), with a different, larger file, it still...
1
6293
by: vin.dor | last post by:
Dear All, I am using WebClient in my Visual Studio .Net 2003 project to download an image from the Internet. The following is my function: C# Code: public static bool downloadFile(string URL, ref string fileName) { bool result = true;
0
1243
by: BrianDH | last post by:
Hi We are using NetworkCredential with Active Dir to validate the user. The problem we are having is, when the user is required to change his password at logon (every 90 days) the NetworkCredential call fails. Its seems to take about an hour before the password propagates and starts to work. Is there a work around?
4
7784
by: Lehel Kovach | last post by:
I'm having a problem with the WebClient object. When I post data to certain sites, it will receive a command from the webserver (object moved) and continue to the next link by downloading that. The problem is, certain cookies need to be set, and the only way of doing that is not letting the WebClient automatically go on to the next GET in the background--I need to do it manually. I'm wondering if this has something to do with the...
2
3966
by: Tosco | last post by:
I read many examples with NetworkCredential and WebClient, but no one with a real http address. They all work in theory, but I wasn't able to use them in the real world. The following code should access an ebay page. There is no redirection involved in TestPage. If you have an ebay account you can try it in 1 minute. What's wrong with my code?
1
7639
by: Guy | last post by:
I use SmtpClient to send mail. My customer reported that sending mail was throwing an exception on his machine "the SMPT client requires a secure connection or the client was not authenticated". so I now provide credentials with my request, however it sends mail all the time, whichever username or password I use. I even removed the password from my Outlook account options. Sends mail anyway ? Is there a credential cache in Windows...
2
10175
by: MichaelSchoeler | last post by:
Hi, I'm having problems with the WebClient class regarding UTF-8 encoded data. When I access a specific webservice directly I can see the data arrives in corretly formatted UTF-8. But when I try to pull data from the same webservice url through the WebClient class I get partly garbled UTF-8 data in return. Only some UTF-8 chars (double byte pairs) seems to be corrupted. // Does not work WebClient wc = new WebClient(); string...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8979
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.