Solved

Download websites source

Posted on 2014-09-23
4
115 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Expert Comment

by:karunamoorthy p
ID: 40339500
>>"website.com"
show the actual site instead. I will try it for you.
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

707 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