1

I'm trying to connect and download website content that requires an authentication that is not "overloaded".

The options are:

  • user
  • user+password,
  • user+password+domain

I need user+subscriber+password. How can i pass this credentials?

code:

WebClient client = new WebClient(); public void search() { client.Credentials = new System.Net.NetworkCredential(username, subscriber, password); //not really exist Byte[] pageData = client.DownloadData("https://example.com/"); ... } 
5
  • Telling us what https://thewebsite.i.need/ is will go a long way to someone being able to help you. Commented Mar 11, 2013 at 10:12
  • sorry, it's work-related internal website. you wont have access to it Commented Mar 11, 2013 at 10:21
  • 1
    @ModusRoeiPonens Please add answer to this question below and accept it when you are able in a couple of days so that we can all benefit. Commented Mar 11, 2013 at 13:28
  • 1
    If you want to answer you own question, do so in an answer. Don't edit the title add add SOLVED to it. If you do want to write an answer, then make sure it is comprehensive. If you can't be bothered to do that, delete the question. Commented Mar 11, 2013 at 13:28
  • didn't know, answer added. Commented Mar 13, 2013 at 8:42

1 Answer 1

1

How i solved the problem: used a POST method with improvedWebClient class, that is like webclient but one that saves cookies. you can find it here.
code:

ImprovedWebClient wc = new ImprovedWebClient(); wc.DownloadData("https://theWebSite.com"); //to enter home page and get cookie string URI = "https://theWebSite.com/authenticate"; //the login page string myParameters = "user=theUserName&subscriber_number=1234-5678&password=myPassword&commit=LogIn"; //the parameters for the website wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; wc.UploadString(URI, myParameters); 

thanks for the help guys.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.