?
Solved

HTTPS to get information

Posted on 2005-03-23
4
Medium Priority
?
175 Views
Last Modified: 2010-04-16
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?
0
Comment
Question by:cossy74
[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
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
Thandava Vallepalli earned 2000 total points
ID: 13619078
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
 

Expert Comment

by:mubama0n
ID: 13643634
============================
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
 

Expert Comment

by:mubama0n
ID: 13643658
My Example If you want to read from Text File (Generaly speacking).
0
 

Author Comment

by:cossy74
ID: 13647648
itsvtk: Your code works but how do i send say the user name and password to this https page?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

777 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