HTTPS to get information

Hi,

currently i have a site that uses https login to access client information.
Part of this site has osome pages that display table information.

i was wondering if any one could point me in the direction of writting a c# program to log onto this site and then send httprequests to get the information?
cossy74Asked:
Who is Participating?
 
Thandava VallepalliConnect With a Mentor Commented:
try this code....


//http://www.csharp-station.com/HowTo/HttpWebFetch.aspx


===============================
using System;
using System.IO;
using System.Net;
using System.Text;


/// <summary>
/// Fetches a Web Page
/// </summary>
class WebFetch
{
      static void Main(string[] args)
      {
            // used to build entire input
            StringBuilder sb  = new StringBuilder();

            // used on each read operation
            byte[]        buf = new byte[8192];

            // prepare the web page we will be asking for
            HttpWebRequest  request  = (HttpWebRequest) WebRequest.Create("https://secure.experts-exchange.com/jsp/editPremiumServices.jsp");

            // execute the request
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            // we will read data via the response stream
            Stream resStream = response.GetResponseStream();

            string tempString = null;
            int    count      = 0;

            do
            {
                  // fill the buffer with data
                  count = resStream.Read(buf, 0, buf.Length);

                  // make sure we read some data
                  if (count != 0)
                  {
                        // translate from bytes to ASCII text
                        tempString = Encoding.ASCII.GetString(buf, 0, count);

                        // continue building the string
                        sb.Append(tempString);
                  }
            }
            while (count > 0); // any more data to read?
            
            resStream.Close();
            
            // print out page source
            Console.WriteLine(sb.ToString());
      }
}

=========================================


itsvtk

0
 
mubama0nCommented:
============================
using System;
using System.IO;
using System.Net;
using System.Text;


/// <summary>
/// Fetches a Web Page
/// </summary>
class WebFetch
{
     static void Main(string[] args)
     {
          // prepare the web page we will be asking for
          HttpWebRequest  request  = (HttpWebRequest)     WebRequest.Create("http://localhost/Mypersonaldir/mytextfile.txt");

          // execute the request
          HttpWebResponse response = (HttpWebResponse)request.GetResponse();

          // we will read data via the response stream
          Stream resStream = response.GetResponseStream();

          StreamReader sr = new StreamReader( resStream, Encoding.ASCII );
         
          string read = null;
         
          while ((read = sr.ReadLine()) != null)
          {
               Console.WriteLine(read);
          }
          sr.Close();
     }
}
0
 
mubama0nCommented:
My Example If you want to read from Text File (Generaly speacking).
0
 
cossy74Author Commented:
itsvtk: Your code works but how do i send say the user name and password to this https page?
0
All Courses

From novice to tech pro — start learning today.