locked
HTTP Tunneling RRS feed

  • Question

  • User1473052319 posted

    Hi,

     I am trying to create a HTTP Tunneling application. I.e. to bypass firewalls and proxies, to allow for a specialised remote desktop solution for a helpdesk company.

     I have done some research into what is needed, apparently there are various methods to do this some more effective than others. But I don't know the specifics.

    Does anyone here know what the fastest methods are to do this using .NET, and do you know what specific requests / responses are needed. See http://www.htthost.com/quick_overview.boa I am quite interested in any one who know how to do both these methods.

    Wednesday, May 9, 2007 1:28 AM

Answers

  • User-900677162 posted

    Hi,

    I hope this following sampel will help you.

    Source Code:

    // Source Code starts
    <%@ Import Namespace="System.Net" %>
    <%@ Import Namespace="System.IO" %>
    <script language="C#" runat="server">
    void
    Page_Load(Object Src, EventArgs E)
    {
    myPage.Text = readHtmlPage(
    http://www.c-sharpcorner.com);
    }
    private String readHtmlPage(string url)
    {
    String result;
    WebResponse objResponse;
    WebProxy proxyObject =
    new WebProxy("http://urproxy:port/",true);
    WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
    objRequest.Proxy = proxyObject;
    objResponse = objRequest.GetResponse();
    using
    (StreamReader sr =
    new
    StreamReader(objResponse.GetResponseStream()) )
    {
    result = sr.ReadToEnd();
    // Close and clean up the StreamReader
    sr.Close();
    }
    return
    result;
    }
    </script>
    <html>
    <body>
    <b>This content
    is
    being populated from a separate HTTP request to
    <a href="http://www.c-sharpcorner
    .com">www.c-sharpcorner.com</a></b><hr/>
    <asp:literal id="myPage" runat="server"/>
    </body>
    </html>
    // Source Code End
    //While Here is the Code where you need to Provide UserName,Password and //domainName if your Proxy requires these Authentication Mode.
    <%@ Import Namespace="System.Net" %>
    <%@ Import Namespace="System.IO" %>
    <script language="C#" runat="server">
    void
    Page_Load(Object Src, EventArgs E)
    {
    myPage.Text = readHtmlPage(
    http://www.c-sharpcorner.com);
    }
    private String readHtmlPage(string url)
    {
    String result;
    HttpWebRequest makeReq =(HttpWebRequest)WebRequest.Create(
    http://www.shivanicreations.com/);
    NetworkCredential giveCred =
    new NetworkCredential
    ("username","password","domain");
    CredentialCache putCache =
    new
    CredentialCache();
    putCache.Add(
    new
    Uri("http://www.shivanicreations.com/"), "Basic", myCred);
    makeReq.Credentials = myCache;
    WebResponse objResponse;
    objResponse = objRequest.GetResponse();
    using (StreamReader sr = new
    StreamReader(objResponse.GetResponseStream()) )
    {
    result = sr.ReadToEnd();
    // Close and clean up the StreamReader
    sr.Close();
    }
    return
    result;
    }
    </script>
    <html>
    <body>
    <b>The below given Page
    is generated from a separate Request to this
    URL
    <a href="http://www.c-sharpcorner.com">www.c-sharpcorner.com</a></b>
    <hr/>
    <asp:literal id="myPage" runat="server"/>
    </body>
    </html>

    I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 13, 2007 10:34 PM