E
Ernesto Silva
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();
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();