|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Calling URL through Proxy server(Address and Port)/Proxy Scripti 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 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 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 Show quote "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 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 Show quote 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 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_deepak***@yahoo.co.in kr_deepak***@skype.com kr_deepak***@hotmail.com Show quote "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 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_deepak***@yahoo.co.in kr_deepak***@skype.com kr_deepak***@hotmail.com Show quote "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_deepak***@yahoo.co.in > kr_deepak***@skype.com > kr_deepak***@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 Hello, deepak!
Here are the links that may help you ( http://www.codeproject.com/cs/internet/using_pac_files_proxy.asp ) ( http://msdn.microsoft.com/msdnmag/issues/05/08/AutomaticProxyDetection/default.aspx ) d> Should we have to call any API ..?Actually there is one exe file d> named d> "proxycfg.exe" inside C:\windows\system32, and the application d> written is in d> C# windows application... d> Thanks, d> Deepak d> kr_deepak***@yahoo.co.in d> kr_deepak***@skype.com d> kr_deepak***@hotmail.com Show quote d> "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_deepak***@yahoo.co.in >> kr_deepak***@skype.com >> kr_deepak***@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 |
|||||||||||||||||||||||