Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
App. WinForms / WPF .NET
Problema con http connection
mercoledì 05 maggio 2010 - 16.39
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
carlitos081
Profilo
| Newbie
10
messaggi | Data Invio:
mer 5 mag 2010 - 16:39
Ciao a tutti
ho scritto un applicazione per windows mobile 6.1 professional e mi sta dando qualche rogna nell'invio di dati tramite http post.
Il codice in questione è:
void DoConnect(string url) {
string rmc = "Dati GPS RMC non disponibili";
string gga = "Dati GPS GGA non disponibili";
if (!this.gpsPosRMC.Equals("")) {
rmc = this.gpsPosRMC;
}
if (!this.gpsPosGGA.Equals("")) {
gga = this.gpsPosGGA;
}
try
{
//this.WriteInFile("&deviceId= " + this.deviceId + "&rmc= " + rmc + "&time= " + System.DateTime.Now);
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create(url);
// Set the Method property of the request to POST.
request.Method = "POST";
// Create POST data and convert it to a byte array.
string postData = "&deviceId= " + this.deviceId + "&rmc= " + rmc + "&gga= " + System.DateTime.Now;
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
// Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded";
// Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length;
// Get the request stream.
Stream dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
}
catch (Exception e) {
this.WriteInFile("doconnect:::::"+e.Message);
//this.WriteInFile("doConnect"+e.Message);
}
}
Chiamando questo metodo riesco a contattare il server 2-3 volte poi mi si impalla generando quest'eccezione:
in System.Net.HttpWebRequest.finishGetRequestStream()
in System.Net.HttpWebRequest.GetRequestStream()
in DeviceApplication2.Form1.DoConnect()
in DeviceApplication2.Form1.button3_Click()
in System.Windows.Forms.Control.OnClick()
in System.Windows.Forms.Button.OnClick()
in System.Windows.Forms.ButtonBase.WnProc()
in System.Windows.Forms.Control._InternalWnProc()
in Microsoft.AGL.Forms.EVL.EnterMainLoop()
in System.Windows.Forms.Application.Run()
in DeviceApplication2.Program.Main()
Ho provato anche a lanciarla su windows(.exe) e funziona alla grande ma appena produco il .CAB mi funziona per 2-3 volte poi mi si impalla lanciando l'eccezione di sopra!!!!!
AIUTO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Grazie anticipatamente
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !