PC Review


Reply
Thread Tools Rate Thread

Calling URL through Proxy server(Address and Port)/Proxy Script

 
 
=?Utf-8?B?ZGVlcGFr?=
Guest
Posts: n/a
 
      22nd Nov 2006
Hi All,
i m develpoing a .net Window application which has
4 texboxes(tbxURLmfor URL in URL Frame,tbxAddress for address in Proxy
server frame,tbxPort for port in proxy server frame,tbxProxyScript for proxy
script in proxy script frame) and a test button..The requirment is given below

STEP BY STEP GUIDE
1. Input the URL you want to test
2. Choose Proxy script/Proxy server with Address and Port Information/No proxy
3. Enter url to proxy script or info for proxy server in respective text box
4. Press test-button

---------------My Code is -------------------------------------------------
DateTime dt1 = DateTime.Now;
System.Net.HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create(tbxURL.Text.ToString());
//GetResponse for this request.
HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();
DateTime dt2 = DateTime.Now;
lblTimeTaken.Text = Convert.ToString(dt2.Subtract(dt1));
--------------------------------------------------------------------
in this code , i m unable to set the value of proxy script textbox ,if any
or proxy server(Address and port) ,only thing which i do threough this code
is sending the url without any proxyscript ans proxy server(address and port
info) Can anybody tell me how can i do this thorugh the code....
...
i m working on window application as i need *.exe file rather than install
file ....


Thanks,
Deepak

 
Reply With Quote
 
 
 
 
=?Utf-8?B?ZGVlcGFr?=
Guest
Posts: n/a
 
      24th Nov 2006
Hi,

i tried with this code and it comiled and wokred fine but client
told me that when he traced the URL with his customized tool , he found that
my application is not using Proxy Script which i put in the texbox on the
form and i also found later that even code is working fine and application is
fine but we can not use URi class for Proxy Configuration Script.This is
wrong.This is nothing but we are using Address of URL which is diffrent from
ProxyScript.So this is not the solution.

so my question is how to do coding for calling URL when you want to access
that URL(mentioned in the textbox on the window form) with proxyscript.

if anybody have idea ,Please advice (for yours refrence i m giving u the
code which i put ,this code is filling my 2 requirments(URL alone,URL with
address and port) out of total3(URL alone,URL with address and port ,URL with
proxyscript only)

-----------------------------------------My Code is given
Below------------------------------------------------------------------------------------------------
private void Calc_Time_For_URL()

{

if(tbxURL.Text.StartsWith("https://"))

{

//Time of Request

DateTime dt1 = DateTime.Now;

try

{

System.Net.HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create(tbxURL.Text.ToString());

//Proxy Server(Address and Port)

if ((tbxAddress.Text.Length > 0) & (tbxPort.Text.Length >0))

{

myReq.Proxy = new WebProxy(tbxAddress.Text,Convert.ToInt16(tbxPort.Text));

}

//Proxy Script

if (tbxProxyScript.Text.Length > 0)

{

<-------------------THIS CODE IS WRONG, I NEED CODE FOR THIS SECTION

// Create a new Uri object.

Uri newUri=new Uri(tbxProxyScript.Text);

// Associate the newUri object to 'myProxy' object so that new myProxy
settings can be set.

myReq.Proxy = new WebProxy(newUri);

------------------------------------------------->

}


//GetResponse for this request.

HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();

//Time of Response

DateTime dt2 = DateTime.Now;

lblTimeTaken.Text = Convert.ToString(dt2.Subtract(dt1));

//}

}

catch(System.Exception ex)

{

//Time of Response

DateTime dt3 = DateTime.Now;

lblTimeTaken.Text = Convert.ToString(dt3.Subtract(dt1));

string message = "Make Sure URL is enterted with http://www or https://www
as prefix as per your need!!!\nError returned is :\n " + ex.Message;

string caption = "Error!!!";

DialogResult result;

MessageBoxButtons buttons = MessageBoxButtons.OK;

result = MessageBox.Show(message,caption,buttons);

}

}



------------------------------------------------------------------------------------------------------------------------------------------------------------------

Thanks,
Deepak


"Vadym Stetsyak" wrote:

> Hello, deepak!
>
> Here's the sample that uses Proxy server
> ( http://www.c-sharpcorner.com/Code/20...dUsingHTTP.asp )
> ( http://www.codeproject.com/cs/intern...t_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

 
Reply With Quote
 
=?Utf-8?B?ZGVlcGFr?=
Guest
Posts: n/a
 
      24th Nov 2006
Hi Vadym,
Proxy Script(TextBox):
http://www-proxy.ericsson.se:3132/ac...d_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
(E-Mail Removed)
(E-Mail Removed)
(E-Mail Removed)



"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/20...dUsingHTTP.asp )
> >> ( http://www.codeproject.com/cs/intern...t_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

 
Reply With Quote
 
=?Utf-8?B?ZGVlcGFr?=
Guest
Posts: n/a
 
      24th Nov 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
(E-Mail Removed)
(E-Mail Removed)
(E-Mail Removed)

"deepak" wrote:

> Hi Vadym,
> Proxy Script(TextBox):
> http://www-proxy.ericsson.se:3132/ac...d_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
> (E-Mail Removed)
> (E-Mail Removed)
> (E-Mail Removed)
>
>
>
> "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/20...dUsingHTTP.asp )
> > >> ( http://www.codeproject.com/cs/intern...t_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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Detect Proxy Server for calling a WS from Win Form mak mak Microsoft C# .NET 0 12th Jun 2009 03:26 PM
Calling URL using the Proxy Server(address and port)/Proxy Script =?Utf-8?B?ZGVlcGFr?= Microsoft Dot NET 0 22nd Nov 2006 06:25 AM
Users loosing Proxy Server settings when they uncheck User Proxy =?Utf-8?B?S2V2aW4=?= Windows XP Internet Explorer 1 9th Jun 2005 12:19 AM
Localhost Proxy address and port Brock Windows XP General 0 24th Feb 2004 07:37 AM
Create Login script for proxy server and port number Marty Microsoft Windows 2000 Terminal Server Applications 0 8th Jul 2003 03:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:41 PM.