deepak
Fri Nov 24 08:10:02 CST 2006
Should we have to call any API ..?Actually there is one exe file named
"proxycfg.exe" inside C:\windows\system32, and the application written is in
C# windows application...
Thanks,
Deepak
kr_deepak123@yahoo.co.in
kr_deepak123@skype.com
kr_deepak123@hotmail.com
"deepak" wrote:
> Hi Vadym,
> Proxy Script(TextBox):
>
http://www-proxy.ericsson.se:3132/accelerated_pac_base.pac
> Url(TextBox):any URL which starts from https://
>
> The below code is working fine for url (only URL,No ProxyServeri.e Address
> and Port,no Proxy Script ), URL with ProxyServer(Address, Port) as given in
> coding. but not for URL AND Proxy Script, That code needs to be changed.
>
> Thanks for fast reply, if possibel u can reply me soon now as i m siting on
> my workstation only wyaiting for preferct response.
>
> Thanks,
> Deepak
> kr_deepak123@yahoo.co.in
> kr_deepak123@skype.com
> kr_deepak123@hotmail.com
>
>
>
> "Vadym Stetsyak" wrote:
>
> > Hello, deepak!
> >
> > What's proxy script?
> >
> > d> Hi,
> >
> > d> i tried with this code and it comiled and wokred fine but
> > d> client
> > d> told me that when he traced the URL with his customized tool , he
> > d> found that
> > d> my application is not using Proxy Script which i put in the texbox on
> > d> the
> > d> form and i also found later that even code is working fine and
> > d> application is
> > d> fine but we can not use URi class for Proxy Configuration Script.This
> > d> is
> > d> wrong.This is nothing but we are using Address of URL which is
> > d> diffrent from
> > d> ProxyScript.So this is not the solution.
> >
> > d> so my question is how to do coding for calling URL when you want to
> > d> access
> > d> that URL(mentioned in the textbox on the window form) with
> > d> proxyscript.
> >
> > d> if anybody have idea ,Please advice (for yours refrence i m giving u
> > d> the
> > d> code which i put ,this code is filling my 2 requirments(URL alone,URL
> > d> with
> > d> address and port) out of total3(URL alone,URL with address and port
> > d> ,URL with
> > d> proxyscript only)
> >
> > d> -----------------------------------------My Code is given
> > d> Below-----------------------------------------------------------------
> > d> -------------------------------
> > d> private void Calc_Time_For_URL()
> >
> > d> {
> >
> > d> if(tbxURL.Text.StartsWith("https://"))
> >
> > d> {
> >
> > d> //Time of Request
> >
> > d> DateTime dt1 = DateTime.Now;
> >
> > d> try
> >
> > d> {
> >
> > d> System.Net.HttpWebRequest myReq =
> > d> (HttpWebRequest)WebRequest.Create(tbxURL.Text.ToString());
> >
> > d> //Proxy Server(Address and Port)
> >
> > d> if ((tbxAddress.Text.Length > 0) & (tbxPort.Text.Length >0))
> >
> > d> {
> >
> > d> myReq.Proxy = new
> > d> WebProxy(tbxAddress.Text,Convert.ToInt16(tbxPort.Text));
> >
> > d> }
> >
> > d> //Proxy Script
> >
> > d> if (tbxProxyScript.Text.Length > 0)
> >
> > d> {
> >
> > d> <-------------------THIS CODE IS WRONG, I NEED CODE FOR THIS SECTION
> >
> > d> // Create a new Uri object.
> >
> > d> Uri newUri=new Uri(tbxProxyScript.Text);
> >
> > d> // Associate the newUri object to 'myProxy' object so that new
> > d> myProxy
> > d> settings can be set.
> >
> > d> myReq.Proxy = new WebProxy(newUri);
> >
> > d> ------------------------------------------------->
> >
> > d> }
> >
> >
> > d> //GetResponse for this request.
> >
> > d> HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();
> >
> > d> //Time of Response
> >
> > d> DateTime dt2 = DateTime.Now;
> >
> > d> lblTimeTaken.Text = Convert.ToString(dt2.Subtract(dt1));
> >
> > d> //}
> >
> > d> }
> >
> > d> catch(System.Exception ex)
> >
> > d> {
> >
> > d> //Time of Response
> >
> > d> DateTime dt3 = DateTime.Now;
> >
> > d> lblTimeTaken.Text = Convert.ToString(dt3.Subtract(dt1));
> >
> > d> string message = "Make Sure URL is enterted with
http://www or
> > d> https://www
> > d> as prefix as per your need!!!\nError returned is :\n " + ex.Message;
> >
> > d> string caption = "Error!!!";
> >
> > d> DialogResult result;
> >
> > d> MessageBoxButtons buttons = MessageBoxButtons.OK;
> >
> > d> result = MessageBox.Show(message,caption,buttons);
> >
> > d> }
> >
> > d> }
> >
> >
> > d>
> > d> ----------------------------------------------------------------------
> > d> ----------------------------------------------------------------------
> > d> ----------------------
> >
> > d> Thanks,
> > d> Deepak
> >
> >
> > d> "Vadym Stetsyak" wrote:
> >
> > >> Hello, deepak!
> >
> > >> Here's the sample that uses Proxy server
> > >> (
http://www.c-sharpcorner.com/Code/2004/Sept/DownloadUsingHTTP.asp )
> > >> (
http://www.codeproject.com/cs/internet/httpwebrequest_response.asp )
> > >> d> Hi All,
> > >> d> i m develpoing a .net Window application which has
> > >> d> 4 texboxes(tbxURLmfor URL in URL Frame,tbxAddress for address in
> > >> d> Proxy
> > >> d> server frame,tbxPort for port in proxy server frame,tbxProxyScript
> > >> d> for proxy
> > >> d> script in proxy script frame) and a test button..The requirment is
> > >> d> given below
> >
> > >> d> STEP BY STEP GUIDE
> > >> d> 1. Input the URL you want to test
> > >> d> 2. Choose Proxy script/Proxy server with Address and Port
> > >> d> Information/No proxy
> > >> d> 3. Enter url to proxy script or info for proxy server in respective
> > >> d> text box
> > >> d> 4. Press test-button
> >
> > >> d> ---------------My Code is
> > >> d> -------------------------------------------------
> > >> d> DateTime dt1 = DateTime.Now;
> > >> d> System.Net.HttpWebRequest myReq =
> > >> d> (HttpWebRequest)WebRequest.Create(tbxURL.Text.ToString());
> > >> d> //GetResponse for this request.
> > >> d> HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();
> > >> d> DateTime dt2 = DateTime.Now;
> > >> d> lblTimeTaken.Text = Convert.ToString(dt2.Subtract(dt1));
> > >> d>
> > >> --------------------------------------------------------------------
> > >> d> in this code , i m unable to set the value of proxy script textbox
> > >> d> ,if any
> > >> d> or proxy server(Address and port) ,only thing which i do threough
> > >> d> this code
> > >> d> is sending the url without any proxyscript ans proxy server(address
> > >> d> and port
> > >> d> info) Can anybody tell me how can i do this thorugh the code....
> > >> d> ..
> > >> d> i m working on window application as i need *.exe file rather than
> > >> d> install
> > >> d> file ....
> >
> >
> > >> d> Thanks,
> > >> d> Deepak
> >
> >
> > >> --
> > >> Regards, Vadym Stetsyak
> > >> www:
http://vadmyst.blogspot
> >
> > --
> > Regards, Vadym Stetsyak
> > www:
http://vadmyst.blogspot