PC Review


Reply
Thread Tools Rate Thread

Connecting through a computer with proxies

 
 
Ernesto Silva
Guest
Posts: n/a
 
      20th Nov 2003
Hello,

I have a computer that connects to internet using a password
authenticated proxy. I connect my PocketPC through this pc (pocket in
cradle) and i want to know if there are special things to do in my
source code to prevent this? The problem is that i have my connection
(work connection) in Pocket configured with proxies, pocket internet
explorer ask me for login/password but in my aplication the connection
just fails?
Please i need some help, thanks

Ernesto

PS: my actual source code
----------------------------------------------

public static DataSet SubmitAndGetXMLThread(string url, string xmlFile)
{
int theNrAtStopThread=MCommerceUtils.stopThread;

DataSet myDS=new DataSet();
xmlFile="XmlDocument="+xmlFile;
if(theNrAtStopThread==MCommerceUtils.stopThread)
{
try
{
HttpWebRequest req=(HttpWebRequest) WebRequest.Create(url);
req.Method="POST";
req.Timeout=35000;
System.Net.WebProxy myProxy = new WebProxy("192.168.0.17",4480);
req.Proxy = myProxy;

req.ContentType = "application/x-www-form-urlencoded";
req.AllowWriteStreamBuffering=true;

Stream newStream = req.GetRequestStream();



StreamWriter strw=new StreamWriter(newStream);

strw.Write(xmlFile);
strw.Flush();
strw.Close();
newStream.Flush();
newStream.Close();
if(theNrAtStopThread==MCommerceUtils.stopThread)
{
HttpWebResponse result = (HttpWebResponse) req.GetResponse();
Stream receiveStream;
try
{
//result.Close();
receiveStream = result.GetResponseStream();
}
catch(SocketException)
{

System.Windows.Forms.MessageBox.Show(MCommMessages.WebExceptionMessage,MCommMessages.__ApplicationName);
myDS.Clear();
myDS = null;
return myDS;
}
catch(System.Exception)
{

System.Windows.Forms.MessageBox.Show(MCommMessages.WebExceptionMessage,MCommMessages.__ApplicationName);
myDS.Clear();
myDS = null;
return myDS;
}
Encoding encode = Encoding.Default;

//System.Text.Encoding.GetEncoding("unicode");
//Encoding encode = System.Text.Encoding.GetEncoding("");
StreamReader sr = new StreamReader( receiveStream, encode );

Char[] read = new Char[256];
int count = sr.Read( read, 0, 256 );
string output="";
while (count > 0)
{
output+=new String(read, 0, count);
count = sr.Read(read, 0, 256);
}

receiveStream.Flush();
receiveStream.Close();
sr.Close();
result.Close();

 
Reply With Quote
 
 
 
 
David Kline [msft]
Guest
Posts: n/a
 
      25th Nov 2003
Ernesto,

You will need to construct a NetworkCredential object set the
HttpWebRequest.Credentials property. If you wish for the user to be
prompted for credentials, you will need to create and display an
appropriate form.

Thanks,
David Kline
Microsoft .NET Compact Framework
--------------------------------
This posting is provided “AS IS” with no warranties, and confers no
rights.

Please do not send email directly to this alias. This alias is for
newsgroup purposes only. To correspond with me directly, remove the
'online' from
my alias.

 
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
Connecting to printer on XP computer from Vista computer Duane Bender Windows Vista Networking 5 5th Jan 2009 02:55 AM
problem connecting to windows 2000 computer from XP computer chris Windows Networking 2 6th Oct 2006 04:25 PM
Connecting a Win95 computer to the internet via a WinXP computer =?Utf-8?B?QXJpZQ==?= Windows XP Networking 1 6th Apr 2006 08:19 PM
is it necessry to disconnect from a computer/WMI in a script before connecting to another computer? emebohw@netscape.net Windows XP WMI 0 22nd Dec 2004 12:28 AM
The specified remote computer could not be found. Verify that you have typed the correct computer name or ip address, and then try connecting again. =?Utf-8?B?U3RhY2V5?= Windows XP Work Remotely 3 20th Mar 2004 08:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:56 PM.