I wrote a small app that dl youtube vids but like most company's they dont allow you to view youtube so i would like to incorporate a proxy option into my app to dl the youtube vids through a supplied proxy ip and port.

Thank you for your time.

Recommended Answers

All 6 Replies

If your are working with asp.net web application then it is easy and fast in asp.net using httpmodule.
Read this article - http://www.hanselman.com/blog/AnIPAddressBlockingHttpModuleForASPNETIn9Minutes.aspx
Extending ASP.NET Processing with HTTP Modules

This is a desktop application, I just want to learn how to implement proxy settings in my applications to give more privacy when using my apps. I read that the System.Net.WebProxy class could be the answer but im not sure anyone clarify this for me please

thank you for your post

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Web;
using System.IO;

namespace daniweb
{
  public partial class frmProxy : Form
  {
    public frmProxy()
    {
      InitializeComponent();
    }

    private bool useProxy;

    private void button1_Click(object sender, EventArgs e)
    {
      useProxy = true;
      WebProxy proxy = new WebProxy("146.57.249.99", 3124);
      HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(@"http://www.whatismyip.com");
      if (useProxy)
        req.Proxy = proxy;
      req.Method = "GET";
      HttpWebResponse objResponse = (HttpWebResponse)req.GetResponse();
      string htmlStuff;
      using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
      {
        htmlStuff = sr.ReadToEnd();
        sr.Close();
      }
      System.Diagnostics.Debugger.Break();
    }
  }
}

Awesome thank you i will try and implement this with in my apps.

Thank you again

You're welcome

Please mark this thread as solved if you have found a solution to your problem and good luck!

so with that implementation above how would i download a file going through a proxy?

for testing to see if it work i was trying to use the webbrowser control i couldn't get the webbrower control to use the proxy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.