Solved

Download websites source

Posted on 2014-09-23
4
107 Views
Last Modified: 2014-09-26
Hi Experts,

I am downloading a website's source text into a string using the following code.

Dim sourceString As String = New System.Net.WebClient().DownloadString("website.com")

The problem I am having is that the downloaded text assumes I have not logged in. When I load the site from my browser the site assumes I am logged in via a stored cookie I presume. How can I present the cookie before downloading the source text?
0
Comment
Question by:DColin
4 Comments
 

Expert Comment

by:karunamoorthy p
ID: 40339500
>>"website.com"
show the actual site instead. I will try it for you.
0
 

Author Comment

by:DColin
ID: 40339762
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 250 total points
ID: 40342063
0
 
LVL 28

Assisted Solution

by:Ark
Ark earned 250 total points
ID: 40345356
To use default (cached) login:
Dim wc = New System.Net.WebClient
wc.UseDefaultCredentials = True

Open in new window

To pass credentials:
wc.Credentials = new NetworkCredential("username", "password", "domain")

Open in new window

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question