473,698 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with HTTPWebRequest on Pocket PC 2003 SE Emulator

Hello all, I'm trying to create a simple application that does a HTTP
request/response on a button click. Here's the entire code which I got
from a reference book:

using System.Collecti ons.Generic;

using System.Componen tModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows. Forms;

using System.IO;

using System.Net;

namespace emulator2

{

public partial class Form1 : Form

{

public Form1()

{

InitializeCompo nent();

}

public void button1_Click(o bject sender, EventArgs e)

{

Uri l_Uri = new Uri("http://www.testing.com ");

HttpWebRequest l_WebReq = (HttpWebRequest )WebRequest.Cre ate(l_Uri);

HttpWebResponse l_WebResponse =
(HttpWebRespons e)l_WebReq.GetR esponse();

Stream l_responseStrea m = l_WebResponse.G etResponseStrea m();

StreamReader l_SReader = new StreamReader(l_ responseStream) ;

string resultstring = l_SReader.ReadT oEnd();

Console.WriteLi ne(resultstring );

}

}

}

The thing that puzzles me is that when I shift the entire chunk of code
to a Windows Application, it works fine. But when I use it on a Device
Application, it just throws me an error. Here are the details of the
error:

System.Net.WebE xception was unhandled
Message="Could not establish connection to network."
StackTrace:
at System.Net.Http WebRequest.fini shGetResponse()
at System.Net.Http WebRequest.GetR esponse()
at emulator2.Form1 .button1_Click( )
at System.Windows. Forms.Control.O nClick()
at System.Windows. Forms.Button.On Click()
at System.Windows. Forms.ButtonBas e.WnProc()
at System.Windows. Forms.Control._ InternalWnProc( )
at Microsoft.AGL.F orms.EVL.EnterM ainLoop()
at System.Windows. Forms.Applicati on.Run()
at emulator2.Progr am.Main()
The error points at this line:

HttpWebResponse l_WebResponse =
(HttpWebRespons e)l_WebReq.GetR esponse();

Does anyone have any idea on how to solve this? I need to get this
solved real quick..so any help given is greatly appreciated! Thanks!

May 14 '06 #1
1 3947
on web it works on HTTP POST but Device application works on soap.

"bl*****@yahoo. com" wrote:
Hello all, I'm trying to create a simple application that does a HTTP
request/response on a button click. Here's the entire code which I got
from a reference book:

using System.Collecti ons.Generic;

using System.Componen tModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows. Forms;

using System.IO;

using System.Net;

namespace emulator2

{

public partial class Form1 : Form

{

public Form1()

{

InitializeCompo nent();

}

public void button1_Click(o bject sender, EventArgs e)

{

Uri l_Uri = new Uri("http://www.testing.com ");

HttpWebRequest l_WebReq = (HttpWebRequest )WebRequest.Cre ate(l_Uri);

HttpWebResponse l_WebResponse =
(HttpWebRespons e)l_WebReq.GetR esponse();

Stream l_responseStrea m = l_WebResponse.G etResponseStrea m();

StreamReader l_SReader = new StreamReader(l_ responseStream) ;

string resultstring = l_SReader.ReadT oEnd();

Console.WriteLi ne(resultstring );

}

}

}

The thing that puzzles me is that when I shift the entire chunk of code
to a Windows Application, it works fine. But when I use it on a Device
Application, it just throws me an error. Here are the details of the
error:

System.Net.WebE xception was unhandled
Message="Could not establish connection to network."
StackTrace:
at System.Net.Http WebRequest.fini shGetResponse()
at System.Net.Http WebRequest.GetR esponse()
at emulator2.Form1 .button1_Click( )
at System.Windows. Forms.Control.O nClick()
at System.Windows. Forms.Button.On Click()
at System.Windows. Forms.ButtonBas e.WnProc()
at System.Windows. Forms.Control._ InternalWnProc( )
at Microsoft.AGL.F orms.EVL.EnterM ainLoop()
at System.Windows. Forms.Applicati on.Run()
at emulator2.Progr am.Main()
The error points at this line:

HttpWebResponse l_WebResponse =
(HttpWebRespons e)l_WebReq.GetR esponse();

Does anyone have any idea on how to solve this? I need to get this
solved real quick..so any help given is greatly appreciated! Thanks!

May 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3554
by: Rafael Pivato | last post by:
Hi, How can i debug applications at Pocket PC 2003 Emulator ? (VS.NET 2003) And how do I include a app.config file at my Smart Device VB Application? thanks, Rafael Pivato
1
1604
by: juan5 | last post by:
Hi I purchased an h5500 series HP pocket pc. Using VS.NET 2003 I am able to build and deploy to the Pocket PC 2002 Emulator but not to debug the app The app is "installed" in the emulator just fine but that's all that happens What's going on Thanks Juan Dent
4
5995
by: Mark Irvine | last post by:
Hi, I recently upgraded to anAMD64 3400 and installed XP SP2. Unpon trying to run a smart application on the emulator, I recieved and error message: "Emulator for Windows CE One or more files from the Emulator for Windows CE installation is missing. Please reinstall Emulator for Windows CE and try again."
11
6632
by: Abhishek | last post by:
I have a problem transfering files using sockets from pocket pc(.net compact c#) to desktop(not using .net just mfc and sockets 2 API). The socket communication is not a issue and I am able to transfer data across.On the serve I am using Socket 2 API (recv function to read bytes)and not using ..NET. I use FileStream to open the file on the pocket pc, then associate a BinaryReader object with the stream and call ReadBytes to read all the...
3
6937
by: minying | last post by:
Hi everyone! I am experiencing a problem when trying to establish a TCP connection between a program running locally and another program running on the Pocket PC emulator provided by the .NET 2003 environment.
2
2390
by: Claire | last post by:
Running visual studio .net 2003, Ive created a project for a pocket pc. I want to run it in my pocket pc 2003 emulator because if I use that particular one I can connect the emulator to activesync using some 3rd party software. Visual studio keeps opening up a Pocket pc 2002 emulator (the default device). How can I force Visual Studio to use the 2003 emulator instead please. Claire
0
974
by: summer00 | last post by:
HI, This xml http://www.pocketpcthoughts.com/xml/ display perfect in IE6 , XML is generally supported in pocket IE if im not mistaken , but when i try to view this in the pocket pc 2003 emulator, i found that the xml cannot be expanded , any idea? thanks a lot Posted Via Usenet.com Premium Usenet Newsgroup Services ----------------------------------------------------------
2
3369
by: Mihai Popescu | last post by:
I wrote a simple application in MFC that uses MSComm ActiveX Control for serial communication. This app works just fine but I have to port it to Pocket PC. So, I wrote another simple application in C# for Pocket PC now using a System.IO.Ports.SerialPort object with the same communication parameters as the former: 19200,n,8,1 and on COM4. The problem is that the latter app generates an IO exception System.IO.FileNotFoundException cause...
1
4707
by: dege | last post by:
Hi, I am developing a Device Aplication in C# and I have a problem with connection from Visual Studio 2005 to SQL Server 2005. My connection string should be correct: SqlConnection cn = new SqlConnection; cn.ConnectionString="Data source=MyPC;Initial Catalog=MyDB;User ID=MyID;Password=MyPassword;" try { cn.Open // this is where I get sqlException: Specified SQL server not found: MyPC ... I enabled TCP/IP in SQL Server Configuration...
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.