473,796 Members | 2,464 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 2694
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
13305
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
3945
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
6934
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
22108
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
3967
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
7641
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
10176
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
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10230
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
10174
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
10012
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
6788
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
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2926
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.