PC Review


Reply
Thread Tools Rate Thread

The connection was closed.

 
 
support@missmobile.net
Guest
Posts: n/a
 
      1st Jun 2007
Hi, I have a web page that call another one with this code:

WebClient SendSite = new WebClient();
SendSite.Headers.Add("Content-Type", "application/x-www-form-
urlencoded");
string StrReqSend = "Par1=aaa&Par2=2222";
byte[] Param = System.Text.Encoding.ASCII.GetBytes(StrReqSend);
byte[] Rps = SendSite.UploadData("http://localhost/nomeprogetto/
prova.aspx", "POST", Param);

The web page called read the parameters, run the code and return 1 or
0.

The code that prepare the answer is the follow:

private void WriteResult(string StrResult)
{
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "text/plain";
Response.ContentEncoding = System.Text.Encoding.Default;
Response.Write(StrResult);
Response.Flush();
Response.Close();
}

When I run the code happen an error:

Unable to read data from the transport connection: The connection was
closed.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.IOException: Unable to read data from the
transport connection: The connection was closed.


How can I solve the problem?

Thanks in advice.

 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      1st Jun 2007
Try commenting out Response.Close(); and see what happens.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi, I have a web page that call another one with this code:
>
> WebClient SendSite = new WebClient();
> SendSite.Headers.Add("Content-Type", "application/x-www-form-
> urlencoded");
> string StrReqSend = "Par1=aaa&Par2=2222";
> byte[] Param = System.Text.Encoding.ASCII.GetBytes(StrReqSend);
> byte[] Rps = SendSite.UploadData("http://localhost/nomeprogetto/
> prova.aspx", "POST", Param);
>
> The web page called read the parameters, run the code and return 1 or
> 0.
>
> The code that prepare the answer is the follow:
>
> private void WriteResult(string StrResult)
> {
> Response.ClearHeaders();
> Response.ClearContent();
> Response.ContentType = "text/plain";
> Response.ContentEncoding = System.Text.Encoding.Default;
> Response.Write(StrResult);
> Response.Flush();
> Response.Close();
> }
>
> When I run the code happen an error:
>
> Unable to read data from the transport connection: The connection was
> closed.
> Description: An unhandled exception occurred during the execution of
> the current web request. Please review the stack trace for more
> information about the error and where it originated in the code.
>
> Exception Details: System.IO.IOException: Unable to read data from the
> transport connection: The connection was closed.
>
>
> How can I solve the problem?
>
> Thanks in advice.
>



 
Reply With Quote
 
support@missmobile.net
Guest
Posts: n/a
 
      4th Jun 2007
On 2 Giu, 00:56, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> wrote:
> Try commenting out Response.Close(); and see what happens.
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBAhttp://gregorybeamer.spaces.live.com
> Co-author: Microsoft Expression Web Bible (upcoming)
>
> ************************************************
> Think outside the box!
> ************************************************<supp...@missmobile.net> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > Hi, I have a web page that call another one with this code:

>
> > WebClient SendSite = new WebClient();
> > SendSite.Headers.Add("Content-Type", "application/x-www-form-
> > urlencoded");
> > string StrReqSend = "Par1=aaa&Par2=2222";
> > byte[] Param = System.Text.Encoding.ASCII.GetBytes(StrReqSend);
> > byte[] Rps = SendSite.UploadData("http://localhost/nomeprogetto/
> > prova.aspx", "POST", Param);

>
> > The web page called read the parameters, run the code and return 1 or
> > 0.

>
> > The code that prepare the answer is the follow:

>
> > private void WriteResult(string StrResult)
> > {
> > Response.ClearHeaders();
> > Response.ClearContent();
> > Response.ContentType = "text/plain";
> > Response.ContentEncoding = System.Text.Encoding.Default;
> > Response.Write(StrResult);
> > Response.Flush();
> > Response.Close();
> > }

>
> > When I run the code happen an error:

>
> > Unable to read data from the transport connection: The connection was
> > closed.
> > Description: An unhandled exception occurred during the execution of
> > the current web request. Please review the stack trace for more
> > information about the error and where it originated in the code.

>
> > Exception Details: System.IO.IOException: Unable to read data from the
> > transport connection: The connection was closed.

>
> > How can I solve the problem?

>
> > Thanks in advice.- Nascondi testo tra virgolette -

>
> - Mostra testo tra virgolette -


Hi, if I comment Response.Close(); works fine but i receive too HTML
code.

The page must contain only the value of "StrResult" because the same
page are request by a lot of VB6 application.

I can't upgrade all VB6 application....

Thanks in advice

Matteo

 
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
VB.NET application cliick-once deployment via internet - Error - Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. Peri Microsoft VB .NET 2 29th Feb 2008 08:46 AM
ExecuteReader requires an open and available Connection. The connection's current state is Closed. renu renu via .NET 247 Microsoft ADO .NET 1 23rd Jan 2005 08:40 PM
ExecuteReader requires an open and available Connection. The connection's current state is Closed. renu renu via .NET 247 Microsoft ADO .NET 1 23rd Dec 2004 12:23 PM
ExecuteReader requires an open and available Connection. The connection's current state is Closed. renu renu via .NET 247 Microsoft ADO .NET 1 1st Nov 2004 02:33 PM
ExecuteReader requires an open and available Connection. The connection's current state is Closed. renu renu via .NET 247 Microsoft ADO .NET 1 17th Oct 2004 01:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:12 PM.