Consuming webservices with gprs

K

Krudler

have a simple application that tries to consume a web service. It works
fine when the PocketPC is connected to the Internet via ActiveSync, but when
it attempts to use a GPRS connection, only the first invocation of the web
service succeeds, all others fail with a WebException. - protocolerror

If I close the application and restart it will allow me to access the
webservice again but only once,
I thought it may have had something to do with the garbage collector , but
adding cleanup code doesnt seem to help

If have installed .NETCF Service Pack 3 onto my devices but the problem
still exists.
I am testing on smartphone 2003 and ppc 2003

I have found that calling the webservice using http post works for muliple
webrequest

Here is some sample test code,

It works fine over gprs if I use my httprequesttest method muliple times, if
I use the my webserviceproxytest it only works once over gprs.
They both work fine if connected through acticesync.




using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Xml;
using System.IO;
using System.Text;

namespace Smartphonetester
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu2;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.MainMenu mainMenu1;
private ConfigServices.DeviceManagement deviceManagement;
private System.Windows.Forms.TextBox textBox1;
private int count = 0 ;


public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.mainMenu2 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.textBox1 = new System.Windows.Forms.TextBox();
//
// mainMenu2
//
this.mainMenu2.MenuItems.Add(this.menuItem1);
//
// menuItem1
//
this.menuItem1.Text = "Exit";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(16, 128);
this.checkBox1.Text = "checkBox1";
this.checkBox1.Click += new System.EventHandler(this.checkBox1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(8, 16);
this.textBox1.Multiline = true;
this.textBox1.Size = new System.Drawing.Size(152, 96);
this.textBox1.Text = "textBox1";
//
// Form1
//
this.Controls.Add(this.textBox1);
this.Controls.Add(this.checkBox1);
this.Menu = this.mainMenu2;
this.Text = "Form1";

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>

static void Main()
{

Application.Run(new Form1());


}

private void menuItem1_Click(object sender, System.EventArgs e)
{
Application.Exit();
}

private void checkBox1_Click(object sender, System.EventArgs e)
{
webserviceproxytest();
}

private void webserviceproxytest()
{

deviceManagement = new ConfigService.DeviceManagement();
deviceManagement.Url = "mywebserviceURL";

deviceManagement.Timeout = 100000;//The default is 100 000 milliseconds.

int userid = Int32.MinValue;


FlowGroup.Crypto.MD5 md =
FlowGroup.Crypto.MD5CryptoServiceProvider.Create();
byte[] hash;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] buffer = enc.GetBytes("password");
hash = md.ComputeHash(buffer);

try
{

ConfigurationServices.ReturnCode rc = deviceManagement.AuthUser("brad",
hash, out userid);
textBox1.Text = userid.ToString();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}

deviceManagement.Abort();


}

private void httprequesttest()
{


// Create a 'WebRequest' object with the specified url.
WebRequest myWebRequest = WebRequest.Create("mywebserviceURL+params");

// Send the 'WebRequest' and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse();

// Obtain a 'Stream' object associated with the response object.
Stream ReceiveStream = myWebResponse.GetResponseStream();

Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

// Pipe the stream to a higher level stream reader with the required
encoding format.
StreamReader readStream = new StreamReader( ReceiveStream, encode );
StringBuilder output = new StringBuilder();

output.Append("\nResponse stream received");
Char[] read = new Char[256];

// Read 256 charcters at a time.
int count = readStream.Read( read, 0, 256 );
output.Append("HTML...\r\n");

while (count > 0)
{
// Dump the 256 characters on a string and display the string onto the
console.
String str = new String(read, 0, count);
output.Append(str);
count = readStream.Read(read, 0, 256);
}

textBox1.Text = output.ToString();

// Release the resources of stream object.
readStream.Close();

// Release the resources of response object.
myWebRequest.Abort();
myWebResponse.Close();

}



}
}






Thanks
Brad
 
S

Sergey Bogdanov

Have you tried to remove deviceManagement.Abort() in this case it
doesn't need you? Also I recomend you to use asynchronous web calls
instead and implement custom timeouts with WebClientAsyncResult.Abort.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com

have a simple application that tries to consume a web service. It works
fine when the PocketPC is connected to the Internet via ActiveSync, but when
it attempts to use a GPRS connection, only the first invocation of the web
service succeeds, all others fail with a WebException. - protocolerror

If I close the application and restart it will allow me to access the
webservice again but only once,
I thought it may have had something to do with the garbage collector , but
adding cleanup code doesnt seem to help

If have installed .NETCF Service Pack 3 onto my devices but the problem
still exists.
I am testing on smartphone 2003 and ppc 2003

I have found that calling the webservice using http post works for muliple
webrequest

Here is some sample test code,

It works fine over gprs if I use my httprequesttest method muliple times, if
I use the my webserviceproxytest it only works once over gprs.
They both work fine if connected through acticesync.




using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Xml;
using System.IO;
using System.Text;

namespace Smartphonetester
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu2;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.MainMenu mainMenu1;
private ConfigServices.DeviceManagement deviceManagement;
private System.Windows.Forms.TextBox textBox1;
private int count = 0 ;


public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.mainMenu2 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.textBox1 = new System.Windows.Forms.TextBox();
//
// mainMenu2
//
this.mainMenu2.MenuItems.Add(this.menuItem1);
//
// menuItem1
//
this.menuItem1.Text = "Exit";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(16, 128);
this.checkBox1.Text = "checkBox1";
this.checkBox1.Click += new System.EventHandler(this.checkBox1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(8, 16);
this.textBox1.Multiline = true;
this.textBox1.Size = new System.Drawing.Size(152, 96);
this.textBox1.Text = "textBox1";
//
// Form1
//
this.Controls.Add(this.textBox1);
this.Controls.Add(this.checkBox1);
this.Menu = this.mainMenu2;
this.Text = "Form1";

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>

static void Main()
{

Application.Run(new Form1());


}

private void menuItem1_Click(object sender, System.EventArgs e)
{
Application.Exit();
}

private void checkBox1_Click(object sender, System.EventArgs e)
{
webserviceproxytest();
}

private void webserviceproxytest()
{

deviceManagement = new ConfigService.DeviceManagement();
deviceManagement.Url = "mywebserviceURL";

deviceManagement.Timeout = 100000;//The default is 100 000 milliseconds.

int userid = Int32.MinValue;


FlowGroup.Crypto.MD5 md =
FlowGroup.Crypto.MD5CryptoServiceProvider.Create();
byte[] hash;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] buffer = enc.GetBytes("password");
hash = md.ComputeHash(buffer);

try
{

ConfigurationServices.ReturnCode rc = deviceManagement.AuthUser("brad",
hash, out userid);
textBox1.Text = userid.ToString();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}

deviceManagement.Abort();


}

private void httprequesttest()
{


// Create a 'WebRequest' object with the specified url.
WebRequest myWebRequest = WebRequest.Create("mywebserviceURL+params");

// Send the 'WebRequest' and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse();

// Obtain a 'Stream' object associated with the response object.
Stream ReceiveStream = myWebResponse.GetResponseStream();

Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

// Pipe the stream to a higher level stream reader with the required
encoding format.
StreamReader readStream = new StreamReader( ReceiveStream, encode );
StringBuilder output = new StringBuilder();

output.Append("\nResponse stream received");
Char[] read = new Char[256];

// Read 256 charcters at a time.
int count = readStream.Read( read, 0, 256 );
output.Append("HTML...\r\n");

while (count > 0)
{
// Dump the 256 characters on a string and display the string onto the
console.
String str = new String(read, 0, count);
output.Append(str);
count = readStream.Read(read, 0, 256);
}

textBox1.Text = output.ToString();

// Release the resources of stream object.
readStream.Close();

// Release the resources of response object.
myWebRequest.Abort();
myWebResponse.Close();

}



}
}






Thanks
Brad
 
K

Krudler

Solution is to use the ip address of the webservice rather than the domain
name.

Brad




Sergey Bogdanov said:
Have you tried to remove deviceManagement.Abort() in this case it doesn't
need you? Also I recomend you to use asynchronous web calls instead and
implement custom timeouts with WebClientAsyncResult.Abort.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com

have a simple application that tries to consume a web service. It works
fine when the PocketPC is connected to the Internet via ActiveSync, but
when
it attempts to use a GPRS connection, only the first invocation of the
web
service succeeds, all others fail with a WebException. - protocolerror

If I close the application and restart it will allow me to access the
webservice again but only once,
I thought it may have had something to do with the garbage collector ,
but
adding cleanup code doesnt seem to help

If have installed .NETCF Service Pack 3 onto my devices but the problem
still exists.
I am testing on smartphone 2003 and ppc 2003

I have found that calling the webservice using http post works for
muliple
webrequest

Here is some sample test code,

It works fine over gprs if I use my httprequesttest method muliple times,
if
I use the my webserviceproxytest it only works once over gprs.
They both work fine if connected through acticesync.




using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Xml;
using System.IO;
using System.Text;

namespace Smartphonetester
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu2;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.MainMenu mainMenu1;
private ConfigServices.DeviceManagement deviceManagement;
private System.Windows.Forms.TextBox textBox1;
private int count = 0 ;


public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.mainMenu2 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.textBox1 = new System.Windows.Forms.TextBox();
//
// mainMenu2
//
this.mainMenu2.MenuItems.Add(this.menuItem1);
//
// menuItem1
//
this.menuItem1.Text = "Exit";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(16, 128);
this.checkBox1.Text = "checkBox1";
this.checkBox1.Click += new System.EventHandler(this.checkBox1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(8, 16);
this.textBox1.Multiline = true;
this.textBox1.Size = new System.Drawing.Size(152, 96);
this.textBox1.Text = "textBox1";
//
// Form1
//
this.Controls.Add(this.textBox1);
this.Controls.Add(this.checkBox1);
this.Menu = this.mainMenu2;
this.Text = "Form1";

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>

static void Main()
{

Application.Run(new Form1());


}

private void menuItem1_Click(object sender, System.EventArgs e)
{
Application.Exit();
}

private void checkBox1_Click(object sender, System.EventArgs e)
{
webserviceproxytest();
}

private void webserviceproxytest()
{

deviceManagement = new ConfigService.DeviceManagement();
deviceManagement.Url = "mywebserviceURL";

deviceManagement.Timeout = 100000;//The default is 100 000
milliseconds.

int userid = Int32.MinValue;


FlowGroup.Crypto.MD5 md =
FlowGroup.Crypto.MD5CryptoServiceProvider.Create();
byte[] hash;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] buffer = enc.GetBytes("password");
hash = md.ComputeHash(buffer);

try
{

ConfigurationServices.ReturnCode rc =
deviceManagement.AuthUser("brad",
hash, out userid);
textBox1.Text = userid.ToString();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}

deviceManagement.Abort();


}

private void httprequesttest()
{


// Create a 'WebRequest' object with the specified url.
WebRequest myWebRequest = WebRequest.Create("mywebserviceURL+params");

// Send the 'WebRequest' and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse();

// Obtain a 'Stream' object associated with the response object.
Stream ReceiveStream = myWebResponse.GetResponseStream();

Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

// Pipe the stream to a higher level stream reader with the required
encoding format.
StreamReader readStream = new StreamReader( ReceiveStream, encode );
StringBuilder output = new StringBuilder();

output.Append("\nResponse stream received");
Char[] read = new Char[256];

// Read 256 charcters at a time.
int count = readStream.Read( read, 0, 256 );
output.Append("HTML...\r\n");

while (count > 0)
{
// Dump the 256 characters on a string and display the string onto
the
console.
String str = new String(read, 0, count);
output.Append(str);
count = readStream.Read(read, 0, 256);
}

textBox1.Text = output.ToString();

// Release the resources of stream object.
readStream.Close();

// Release the resources of response object.
myWebRequest.Abort();
myWebResponse.Close();

}



}
}






Thanks
Brad
 
F

Frank Grossmann

Yes indeed,
I had the same problem which was driving me crazy because it will never show
in the emulator or while the device is in the cradle nor being on the
internet with WLAN.

Doing a litte research on our webserver I found out something really
interesting in the web server logs - the field "HOST" does contain the
correct hostname in fqdn format for the device being in the cradle or being
connected through WLAN (for each request) and for the first request being
done through a wireless GPRS connection, but only the IP address of the host
in case of each following request through a GPRS connection.
Now that is fascinating to me!

I've now spent an additional IP address on the virtual web server with the
webservice (what a waste), and it works!

Thanks Brad for the hint, now we should find out why this is so!

Regards
Frank

webserver log:

through cradle (or wlan)
2005-02-19 22:44:41 W3SVC1747331244 WEB 192.168.1.12 POST /qslinfo.asmx -
80 - 192.168.1.2 HTTP/1.1
Mozilla/4.0+(compatible;+MSIE+6.0;+MS+.NET+CF+Web+Services+Client+Protocol+1.0.4292.0)
- - www.qslinfo.de 200 0 0 760 671 350
2005-02-19 22:44:44 W3SVC1747331244 WEB 192.168.1.12 POST /qslinfo.asmx -
80 - 192.168.1.2 HTTP/1.1
Mozilla/4.0+(compatible;+MSIE+6.0;+MS+.NET+CF+Web+Services+Client+Protocol+1.0.4292.0)
- - www.qslinfo.de 200 0 0 785 671 660

through gprs
2005-02-19 22:48:40 W3SVC1747331244 WEB 192.168.1.12 POST /qslinfo.asmx -
80 - 80.226.224.143 HTTP/1.0
Mozilla/4.0+(compatible;+MSIE+6.0;+MS+.NET+CF+Web+Services+Client+Protocol+1.0.4292.0)
- - www.qslinfo.de 200 0 0 784 696 970
2005-02-19 22:48:45 W3SVC1747331244 WEB 192.168.1.12 POST /qslinfo.asmx -
80 - 80.226.224.143 HTTP/1.0
Mozilla/4.0+(compatible;+MSIE+6.0;+MS+.NET+CF+Web+Services+Client+Protocol+1.0.4292.0)
- - 212.202.155.38 200 0 0 784 674 710

note the difference in the very last line of the log!



--
Dipl.Kaufm. tech. Frank Grossmann dl2cc
Grossmann IT GmbH, Vogelsangstr.23, D-70176 Stuttgart
http://www.grossmann.com

ZentraleTel. +49 711 6150999, Fax +49 711 6150996

Durchwahl Tel.+49 711 6154510, Fax +49 711 6154507, Handy +49 172 7105771






Krudler said:
Solution is to use the ip address of the webservice rather than the domain
name.

Brad




Sergey Bogdanov said:
Have you tried to remove deviceManagement.Abort() in this case it doesn't
need you? Also I recomend you to use asynchronous web calls instead and
implement custom timeouts with WebClientAsyncResult.Abort.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com

have a simple application that tries to consume a web service. It works
fine when the PocketPC is connected to the Internet via ActiveSync, but
when
it attempts to use a GPRS connection, only the first invocation of the
web
service succeeds, all others fail with a WebException. - protocolerror

If I close the application and restart it will allow me to access the
webservice again but only once,
I thought it may have had something to do with the garbage collector ,
but
adding cleanup code doesnt seem to help

If have installed .NETCF Service Pack 3 onto my devices but the problem
still exists.
I am testing on smartphone 2003 and ppc 2003

I have found that calling the webservice using http post works for
muliple
webrequest

Here is some sample test code,

It works fine over gprs if I use my httprequesttest method muliple
times, if
I use the my webserviceproxytest it only works once over gprs.
They both work fine if connected through acticesync.




using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Xml;
using System.IO;
using System.Text;

namespace Smartphonetester
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu2;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.MainMenu mainMenu1;
private ConfigServices.DeviceManagement deviceManagement;
private System.Windows.Forms.TextBox textBox1;
private int count = 0 ;


public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.mainMenu2 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.textBox1 = new System.Windows.Forms.TextBox();
//
// mainMenu2
//
this.mainMenu2.MenuItems.Add(this.menuItem1);
//
// menuItem1
//
this.menuItem1.Text = "Exit";
this.menuItem1.Click += new
System.EventHandler(this.menuItem1_Click);
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(16, 128);
this.checkBox1.Text = "checkBox1";
this.checkBox1.Click += new
System.EventHandler(this.checkBox1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(8, 16);
this.textBox1.Multiline = true;
this.textBox1.Size = new System.Drawing.Size(152, 96);
this.textBox1.Text = "textBox1";
//
// Form1
//
this.Controls.Add(this.textBox1);
this.Controls.Add(this.checkBox1);
this.Menu = this.mainMenu2;
this.Text = "Form1";

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>

static void Main()
{

Application.Run(new Form1());


}

private void menuItem1_Click(object sender, System.EventArgs e)
{
Application.Exit();
}

private void checkBox1_Click(object sender, System.EventArgs e)
{
webserviceproxytest();
}

private void webserviceproxytest()
{

deviceManagement = new ConfigService.DeviceManagement();
deviceManagement.Url = "mywebserviceURL";

deviceManagement.Timeout = 100000;//The default is 100 000
milliseconds.

int userid = Int32.MinValue;


FlowGroup.Crypto.MD5 md =
FlowGroup.Crypto.MD5CryptoServiceProvider.Create();
byte[] hash;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] buffer = enc.GetBytes("password");
hash = md.ComputeHash(buffer);

try
{

ConfigurationServices.ReturnCode rc =
deviceManagement.AuthUser("brad",
hash, out userid);
textBox1.Text = userid.ToString();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}

deviceManagement.Abort();


}

private void httprequesttest()
{


// Create a 'WebRequest' object with the specified url.
WebRequest myWebRequest =
WebRequest.Create("mywebserviceURL+params");

// Send the 'WebRequest' and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse();

// Obtain a 'Stream' object associated with the response object.
Stream ReceiveStream = myWebResponse.GetResponseStream();

Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

// Pipe the stream to a higher level stream reader with the required
encoding format.
StreamReader readStream = new StreamReader( ReceiveStream, encode );
StringBuilder output = new StringBuilder();

output.Append("\nResponse stream received");
Char[] read = new Char[256];

// Read 256 charcters at a time.
int count = readStream.Read( read, 0, 256 );
output.Append("HTML...\r\n");

while (count > 0)
{
// Dump the 256 characters on a string and display the string onto
the
console.
String str = new String(read, 0, count);
output.Append(str);
count = readStream.Read(read, 0, 256);
}

textBox1.Text = output.ToString();

// Release the resources of stream object.
readStream.Close();

// Release the resources of response object.
myWebRequest.Abort();
myWebResponse.Close();

}



}
}






Thanks
Brad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top