473,706 Members | 2,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Net.WebC lient.DownloadF ile doesn't work with http attachments

Hi,

I have an aspx page at the web server that provides PDF documents for smart
client applications.

Here is the code in aspx page that defines content type:

Response.Conten tType = "applicatio n/octet-stream";
Response.Append Header("Content-Disposition", "attachment;fil ename=" +
fileID.ToString () + ".pdf");

I tested the aspx page by using browser and it works just fine.

Now I need to receive that file by using the
System.Net.WebC lient.DownloadF ile. The problem is that DownloadFile method
returns the following exception:

"Unable to read data from the transport connection: The connection was
closed."

I tested the DownloadFile method to open a direct pdf file like the
following statement:

(new
System.Net.WebC lient()).Downlo adFile(http://localhost/test.pdf,"c:\\t est.pdf");

It works just fine.

How can I use System.Net.WebC lient. DownloadFile to download http
attachments?

Any help would be apprecited,
Alan
Nov 17 '05 #1
6 13294
Hi Alan,

Welcome to MSDN newsgroup.
Regarding on the file downloading through WebClient class problem you
mentioned, seems a bit strange from a general view. It is possible a
machine specific issue. here is a test page's code which could be correctly
used (let client user webbrowser or webclient class to download the file)
on my side:

=============== ===
private void Page_Load(objec t sender, System.EventArg s e)
{
Response.ClearH eaders();
Response.ClearC ontent();
Response.Conten tType = "applicatio n/octet-stream";

Response.Append Header("Content-Disposition","a ttachment;filen ame=test.pdf");

Response.WriteF ile(Server.MapP ath("~/files/test.pdf"));

Response.End();
}
=============== ===

You can try the above code in your page to see whether it works. Also, you
can run the webclient from multiple client to see whether it is client
specific.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "A.M-SG" <al******@newsg roup.nospam>
| Subject: System.Net.WebC lient.DownloadF ile doesn't work with http
attachments
| Date: Mon, 31 Oct 2005 18:45:48 -0500
| Lines: 35
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: hse-toronto-ppp3484752.symp atico.ca 65.92.97.129
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:1330 60
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Hi,
|
| I have an aspx page at the web server that provides PDF documents for
smart
| client applications.
|
| Here is the code in aspx page that defines content type:
|
| Response.Conten tType = "applicatio n/octet-stream";
| Response.Append Header("Content-Disposition", "attachment;fil ename=" +
| fileID.ToString () + ".pdf");
|
| I tested the aspx page by using browser and it works just fine.
|
| Now I need to receive that file by using the
| System.Net.WebC lient.DownloadF ile. The problem is that DownloadFile
method
| returns the following exception:
|
| "Unable to read data from the transport connection: The connection was
| closed."
|
| I tested the DownloadFile method to open a direct pdf file like the
| following statement:
|
| (new
|
System.Net.WebC lient()).Downlo adFile(http://localhost/test.pdf,"c:\\t est.pdf
");
|
| It works just fine.
|
| How can I use System.Net.WebC lient. DownloadFile to download http
| attachments?
|
| Any help would be apprecited,
| Alan
|
|
|

Nov 17 '05 #2
Hi Steven,

Firstly thank you for your reply.

The code that you provided is not my question.

My question is: "How to receive that pdf file at the client side?"

The server side is done and it is similar to what you mentioned in your
reply.

I tried to receive the pdf file (test.pdf in your sample) by using
System.Net.WebC lient.DownloadF ile, but it throws exception.

Regards,
Alan

"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:CX******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi Alan,

Welcome to MSDN newsgroup.
Regarding on the file downloading through WebClient class problem you
mentioned, seems a bit strange from a general view. It is possible a
machine specific issue. here is a test page's code which could be
correctly
used (let client user webbrowser or webclient class to download the file)
on my side:

=============== ===
private void Page_Load(objec t sender, System.EventArg s e)
{
Response.ClearH eaders();
Response.ClearC ontent();
Response.Conten tType = "applicatio n/octet-stream";

Response.Append Header("Content-Disposition","a ttachment;filen ame=test.pdf");

Response.WriteF ile(Server.MapP ath("~/files/test.pdf"));

Response.End();
}
=============== ===

You can try the above code in your page to see whether it works. Also, you
can run the webclient from multiple client to see whether it is client
specific.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "A.M-SG" <al******@newsg roup.nospam>
| Subject: System.Net.WebC lient.DownloadF ile doesn't work with http
attachments
| Date: Mon, 31 Oct 2005 18:45:48 -0500
| Lines: 35
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: hse-toronto-ppp3484752.symp atico.ca 65.92.97.129
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:1330 60
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Hi,
|
| I have an aspx page at the web server that provides PDF documents for
smart
| client applications.
|
| Here is the code in aspx page that defines content type:
|
| Response.Conten tType = "applicatio n/octet-stream";
| Response.Append Header("Content-Disposition", "attachment;fil ename=" +
| fileID.ToString () + ".pdf");
|
| I tested the aspx page by using browser and it works just fine.
|
| Now I need to receive that file by using the
| System.Net.WebC lient.DownloadF ile. The problem is that DownloadFile
method
| returns the following exception:
|
| "Unable to read data from the transport connection: The connection was
| closed."
|
| I tested the DownloadFile method to open a direct pdf file like the
| following statement:
|
| (new
|
System.Net.WebC lient()).Downlo adFile(http://localhost/test.pdf,"c:\\t est.pdf
");
|
| It works just fine.
|
| How can I use System.Net.WebC lient. DownloadFile to download http
| attachments?
|
| Any help would be apprecited,
| Alan
|
|
|

Nov 17 '05 #3
Hi Alan,

Yes, I know the serverside code won't have big difference , nor does the
client code. That's why I think this should be a environment specific
issue. Here is the client code I've used to test , (both use WebClient and
HttpWebRequest ....) , the code work correctly on my test environment.

=============== ==========
static void Main(string[] args)
{
DownloadByWebCl ient();
DownloadByHttpW ebRequest();
}

static void DownloadByWebCl ient()
{
string url =
"http://localhost/StevenRoot/ControlWebApp/filedownload.as px";
string clientfile = @"d:\temp\test_ webclient.pdf";

WebClient wc = new WebClient();

wc.DownloadFile (url,clientfile );

}

static void DownloadByHttpW ebRequest()
{
string url =
"http://localhost/StevenRoot/ControlWebApp/filedownload.as px";
string clientfile = @"d:\temp\test_ webrequest.pdf" ;

HttpWebRequest req = WebRequest.Crea te(url) as HttpWebRequest;

req.Method = "GET";
req.KeepAlive = true;

HttpWebResponse rep = req.GetResponse () as HttpWebResponse ;

Stream stream = rep.GetResponse Stream();

FileStream fs = new FileStream(clie ntfile, FileMode.Create ,
FileAccess.Writ e);

byte[] buf = new byte[1024];

int i = 0;

while( (i=stream.Read( buf,0,buf.Lengt h))> 0)
{
fs.Write(buf,0, i);
}

fs.Close();

stream.Close();

rep.Close();

}
=============== =============

In addition, you can also try comment the below line in your serverside
code to see whether it helps:

Response.Append Header("Content-Disposition", "attachment;fil ename=" +
fileID.ToString () + ".pdf");

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "A.M-SG" <al******@newsg roup.nospam>
| References: <#N************ **@TK2MSFTNGP12 .phx.gbl>
<CX************ **@TK2MSFTNGXA0 1.phx.gbl>
| Subject: Re: System.Net.WebC lient.DownloadF ile doesn't work with http
attachments
| Date: Tue, 1 Nov 2005 08:15:42 -0500
| Lines: 124
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| Message-ID: <#H************ **@tk2msftngp13 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: toronto-hse-ppp4253404.symp atico.ca 70.52.252.114
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:1331 23
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Hi Steven,
|
| Firstly thank you for your reply.
|
| The code that you provided is not my question.
|
| My question is: "How to receive that pdf file at the client side?"
|
| The server side is done and it is similar to what you mentioned in your
| reply.
|
| I tried to receive the pdf file (test.pdf in your sample) by using
| System.Net.WebC lient.DownloadF ile, but it throws exception.
|
| Regards,
| Alan
|
|
|
| "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| news:CX******** ******@TK2MSFTN GXA01.phx.gbl.. .
| > Hi Alan,
| >
| > Welcome to MSDN newsgroup.
| > Regarding on the file downloading through WebClient class problem you
| > mentioned, seems a bit strange from a general view. It is possible a
| > machine specific issue. here is a test page's code which could be
| > correctly
| > used (let client user webbrowser or webclient class to download the
file)
| > on my side:
| >
| > =============== ===
| > private void Page_Load(objec t sender, System.EventArg s e)
| > {
| > Response.ClearH eaders();
| > Response.ClearC ontent();
| > Response.Conten tType = "applicatio n/octet-stream";
| >
| >
Response.Append Header("Content-Disposition","a ttachment;filen ame=test.pdf");
| >
| > Response.WriteF ile(Server.MapP ath("~/files/test.pdf"));
| >
| > Response.End();
| > }
| > =============== ===
| >
| > You can try the above code in your page to see whether it works. Also,
you
| > can run the webclient from multiple client to see whether it is client
| > specific.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| > --------------------
| > | From: "A.M-SG" <al******@newsg roup.nospam>
| > | Subject: System.Net.WebC lient.DownloadF ile doesn't work with http
| > attachments
| > | Date: Mon, 31 Oct 2005 18:45:48 -0500
| > | Lines: 35
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | Message-ID: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| > | NNTP-Posting-Host: hse-toronto-ppp3484752.symp atico.ca 65.92.97.129
| > | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| > | Xref: TK2MSFTNGXA01.p hx.gbl
| > microsoft.publi c.dotnet.langua ges.csharp:1330 60
| > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| > |
| > | Hi,
| > |
| > | I have an aspx page at the web server that provides PDF documents for
| > smart
| > | client applications.
| > |
| > | Here is the code in aspx page that defines content type:
| > |
| > | Response.Conten tType = "applicatio n/octet-stream";
| > | Response.Append Header("Content-Disposition", "attachment;fil ename=" +
| > | fileID.ToString () + ".pdf");
| > |
| > | I tested the aspx page by using browser and it works just fine.
| > |
| > | Now I need to receive that file by using the
| > | System.Net.WebC lient.DownloadF ile. The problem is that DownloadFile
| > method
| > | returns the following exception:
| > |
| > | "Unable to read data from the transport connection: The connection was
| > | closed."
| > |
| > | I tested the DownloadFile method to open a direct pdf file like the
| > | following statement:
| > |
| > | (new
| > |
| >
System.Net.WebC lient()).Downlo adFile(http://localhost/test.pdf,"c:\\t est.pdf
| > ");
| > |
| > | It works just fine.
| > |
| > | How can I use System.Net.WebC lient. DownloadFile to download http
| > | attachments?
| > |
| > | Any help would be apprecited,
| > | Alan
| > |
| > |
| > |
| >
|
|
|

Nov 17 '05 #4
Hi Alan,

How are you doing on this issue, have you got any further progress? If
there're anything else we can help, please feel free to post here. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 66213528
| References: <#N************ **@TK2MSFTNGP12 .phx.gbl>
<CX************ **@TK2MSFTNGXA0 1.phx.gbl>
<#H************ **@tk2msftngp13 .phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online. microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Wed, 02 Nov 2005 03:37:50 GMT
| Subject: Re: System.Net.WebC lient.DownloadF ile doesn't work with http
attachments
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| Message-ID: <8h************ **@TK2MSFTNGXA0 1.phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Lines: 167
| Path: TK2MSFTNGXA01.p hx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:1333 08
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Alan,
|
| Yes, I know the serverside code won't have big difference , nor does the
| client code. That's why I think this should be a environment specific
| issue. Here is the client code I've used to test , (both use WebClient
and
| HttpWebRequest ....) , the code work correctly on my test environment.
|
| =============== ==========
| static void Main(string[] args)
| {
|
|
| DownloadByWebCl ient();
|
|
| DownloadByHttpW ebRequest();
| }
|
| static void DownloadByWebCl ient()
| {
| string url =
| "http://localhost/StevenRoot/ControlWebApp/filedownload.as px";
| string clientfile = @"d:\temp\test_ webclient.pdf";
|
| WebClient wc = new WebClient();
|
| wc.DownloadFile (url,clientfile );
|
| }
|
| static void DownloadByHttpW ebRequest()
| {
| string url =
| "http://localhost/StevenRoot/ControlWebApp/filedownload.as px";
| string clientfile = @"d:\temp\test_ webrequest.pdf" ;
|
| HttpWebRequest req = WebRequest.Crea te(url) as HttpWebRequest;
|
| req.Method = "GET";
| req.KeepAlive = true;
|
| HttpWebResponse rep = req.GetResponse () as HttpWebResponse ;
|
| Stream stream = rep.GetResponse Stream();
|
| FileStream fs = new FileStream(clie ntfile, FileMode.Create ,
| FileAccess.Writ e);
|
| byte[] buf = new byte[1024];
|
| int i = 0;
|
| while( (i=stream.Read( buf,0,buf.Lengt h))> 0)
| {
| fs.Write(buf,0, i);
| }
|
| fs.Close();
|
| stream.Close();
|
| rep.Close();
|
| }
| =============== =============
|
| In addition, you can also try comment the below line in your serverside
| code to see whether it helps:
|
| Response.Append Header("Content-Disposition", "attachment;fil ename=" +
| fileID.ToString () + ".pdf");
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
| --------------------
| | From: "A.M-SG" <al******@newsg roup.nospam>
| | References: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| <CX************ **@TK2MSFTNGXA0 1.phx.gbl>
| | Subject: Re: System.Net.WebC lient.DownloadF ile doesn't work with http
| attachments
| | Date: Tue, 1 Nov 2005 08:15:42 -0500
| | Lines: 124
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| | X-RFC2646: Format=Flowed; Original
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| | Message-ID: <#H************ **@tk2msftngp13 .phx.gbl>
| | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| | NNTP-Posting-Host: toronto-hse-ppp4253404.symp atico.ca 70.52.252.114
| | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| | Xref: TK2MSFTNGXA01.p hx.gbl
| microsoft.publi c.dotnet.langua ges.csharp:1331 23
| | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| |
| | Hi Steven,
| |
| | Firstly thank you for your reply.
| |
| | The code that you provided is not my question.
| |
| | My question is: "How to receive that pdf file at the client side?"
| |
| | The server side is done and it is similar to what you mentioned in your
| | reply.
| |
| | I tried to receive the pdf file (test.pdf in your sample) by using
| | System.Net.WebC lient.DownloadF ile, but it throws exception.
| |
| | Regards,
| | Alan
| |
| |
| |
| | "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| | news:CX******** ******@TK2MSFTN GXA01.phx.gbl.. .
| | > Hi Alan,
| | >
| | > Welcome to MSDN newsgroup.
| | > Regarding on the file downloading through WebClient class problem you
| | > mentioned, seems a bit strange from a general view. It is possible a
| | > machine specific issue. here is a test page's code which could be
| | > correctly
| | > used (let client user webbrowser or webclient class to download the
| file)
| | > on my side:
| | >
| | > =============== ===
| | > private void Page_Load(objec t sender, System.EventArg s e)
| | > {
| | > Response.ClearH eaders();
| | > Response.ClearC ontent();
| | > Response.Conten tType = "applicatio n/octet-stream";
| | >
| | >
|
Response.Append Header("Content-Disposition","a ttachment;filen ame=test.pdf");
| | >
| | > Response.WriteF ile(Server.MapP ath("~/files/test.pdf"));
| | >
| | > Response.End();
| | > }
| | > =============== ===
| | >
| | > You can try the above code in your page to see whether it works.
Also,
| you
| | > can run the webclient from multiple client to see whether it is client
| | > specific.
| | >
| | > Thanks,
| | >
| | > Steven Cheng
| | > Microsoft Online Support
| | >
| | > Get Secure! www.microsoft.com/security
| | > (This posting is provided "AS IS", with no warranties, and confers no
| | > rights.)
| | >
| | >
| | >
| | >
| | > --------------------
| | > | From: "A.M-SG" <al******@newsg roup.nospam>
| | > | Subject: System.Net.WebC lient.DownloadF ile doesn't work with http
| | > attachments
| | > | Date: Mon, 31 Oct 2005 18:45:48 -0500
| | > | Lines: 35
| | > | X-Priority: 3
| | > | X-MSMail-Priority: Normal
| | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| | > | X-RFC2646: Format=Flowed; Original
| | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| | > | Message-ID: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| | > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| | > | NNTP-Posting-Host: hse-toronto-ppp3484752.symp atico.ca 65.92.97.129
| | > | Path:
TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| | > | Xref: TK2MSFTNGXA01.p hx.gbl
| | > microsoft.publi c.dotnet.langua ges.csharp:1330 60
| | > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| | > |
| | > | Hi,
| | > |
| | > | I have an aspx page at the web server that provides PDF documents
for
| | > smart
| | > | client applications.
| | > |
| | > | Here is the code in aspx page that defines content type:
| | > |
| | > | Response.Conten tType = "applicatio n/octet-stream";
| | > | Response.Append Header("Content-Disposition", "attachment;fil ename="
+
| | > | fileID.ToString () + ".pdf");
| | > |
| | > | I tested the aspx page by using browser and it works just fine.
| | > |
| | > | Now I need to receive that file by using the
| | > | System.Net.WebC lient.DownloadF ile. The problem is that DownloadFile
| | > method
| | > | returns the following exception:
| | > |
| | > | "Unable to read data from the transport connection: The connection
was
| | > | closed."
| | > |
| | > | I tested the DownloadFile method to open a direct pdf file like the
| | > | following statement:
| | > |
| | > | (new
| | > |
| | >
|
System.Net.WebC lient()).Downlo adFile(http://localhost/test.pdf,"c:\\t est.pdf
| | > ");
| | > |
| | > | It works just fine.
| | > |
| | > | How can I use System.Net.WebC lient. DownloadFile to download http
| | > | attachments?
| | > |
| | > | Any help would be apprecited,
| | > | Alan
| | > |
| | > |
| | > |
| | >
| |
| |
| |
|
|

Nov 17 '05 #5
Hi Steven.

Yes, I got it working. Thank you for your help.

Ali

"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:cZ******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi Alan,

How are you doing on this issue, have you got any further progress? If
there're anything else we can help, please feel free to post here. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 66213528
| References: <#N************ **@TK2MSFTNGP12 .phx.gbl>
<CX************ **@TK2MSFTNGXA0 1.phx.gbl>
<#H************ **@tk2msftngp13 .phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online. microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Wed, 02 Nov 2005 03:37:50 GMT
| Subject: Re: System.Net.WebC lient.DownloadF ile doesn't work with http
attachments
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| Message-ID: <8h************ **@TK2MSFTNGXA0 1.phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Lines: 167
| Path: TK2MSFTNGXA01.p hx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:1333 08
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Alan,
|
| Yes, I know the serverside code won't have big difference , nor does the
| client code. That's why I think this should be a environment specific
| issue. Here is the client code I've used to test , (both use WebClient
and
| HttpWebRequest ....) , the code work correctly on my test environment.
|
| =============== ==========
| static void Main(string[] args)
| {
|
|
| DownloadByWebCl ient();
|
|
| DownloadByHttpW ebRequest();
| }
|
| static void DownloadByWebCl ient()
| {
| string url =
| "http://localhost/StevenRoot/ControlWebApp/filedownload.as px";
| string clientfile = @"d:\temp\test_ webclient.pdf";
|
| WebClient wc = new WebClient();
|
| wc.DownloadFile (url,clientfile );
|
| }
|
| static void DownloadByHttpW ebRequest()
| {
| string url =
| "http://localhost/StevenRoot/ControlWebApp/filedownload.as px";
| string clientfile = @"d:\temp\test_ webrequest.pdf" ;
|
| HttpWebRequest req = WebRequest.Crea te(url) as HttpWebRequest;
|
| req.Method = "GET";
| req.KeepAlive = true;
|
| HttpWebResponse rep = req.GetResponse () as HttpWebResponse ;
|
| Stream stream = rep.GetResponse Stream();
|
| FileStream fs = new FileStream(clie ntfile, FileMode.Create ,
| FileAccess.Writ e);
|
| byte[] buf = new byte[1024];
|
| int i = 0;
|
| while( (i=stream.Read( buf,0,buf.Lengt h))> 0)
| {
| fs.Write(buf,0, i);
| }
|
| fs.Close();
|
| stream.Close();
|
| rep.Close();
|
| }
| =============== =============
|
| In addition, you can also try comment the below line in your serverside
| code to see whether it helps:
|
| Response.Append Header("Content-Disposition", "attachment;fil ename=" +
| fileID.ToString () + ".pdf");
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
| --------------------
| | From: "A.M-SG" <al******@newsg roup.nospam>
| | References: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| <CX************ **@TK2MSFTNGXA0 1.phx.gbl>
| | Subject: Re: System.Net.WebC lient.DownloadF ile doesn't work with http
| attachments
| | Date: Tue, 1 Nov 2005 08:15:42 -0500
| | Lines: 124
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| | X-RFC2646: Format=Flowed; Original
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| | Message-ID: <#H************ **@tk2msftngp13 .phx.gbl>
| | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| | NNTP-Posting-Host: toronto-hse-ppp4253404.symp atico.ca 70.52.252.114
| | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| | Xref: TK2MSFTNGXA01.p hx.gbl
| microsoft.publi c.dotnet.langua ges.csharp:1331 23
| | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| |
| | Hi Steven,
| |
| | Firstly thank you for your reply.
| |
| | The code that you provided is not my question.
| |
| | My question is: "How to receive that pdf file at the client side?"
| |
| | The server side is done and it is similar to what you mentioned in
your
| | reply.
| |
| | I tried to receive the pdf file (test.pdf in your sample) by using
| | System.Net.WebC lient.DownloadF ile, but it throws exception.
| |
| | Regards,
| | Alan
| |
| |
| |
| | "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| | news:CX******** ******@TK2MSFTN GXA01.phx.gbl.. .
| | > Hi Alan,
| | >
| | > Welcome to MSDN newsgroup.
| | > Regarding on the file downloading through WebClient class problem
you
| | > mentioned, seems a bit strange from a general view. It is possible a
| | > machine specific issue. here is a test page's code which could be
| | > correctly
| | > used (let client user webbrowser or webclient class to download the
| file)
| | > on my side:
| | >
| | > =============== ===
| | > private void Page_Load(objec t sender, System.EventArg s e)
| | > {
| | > Response.ClearH eaders();
| | > Response.ClearC ontent();
| | > Response.Conten tType = "applicatio n/octet-stream";
| | >
| | >
|
Response.Append Header("Content-Disposition","a ttachment;filen ame=test.pdf");
| | >
| | > Response.WriteF ile(Server.MapP ath("~/files/test.pdf"));
| | >
| | > Response.End();
| | > }
| | > =============== ===
| | >
| | > You can try the above code in your page to see whether it works.
Also,
| you
| | > can run the webclient from multiple client to see whether it is
client
| | > specific.
| | >
| | > Thanks,
| | >
| | > Steven Cheng
| | > Microsoft Online Support
| | >
| | > Get Secure! www.microsoft.com/security
| | > (This posting is provided "AS IS", with no warranties, and confers
no
| | > rights.)
| | >
| | >
| | >
| | >
| | > --------------------
| | > | From: "A.M-SG" <al******@newsg roup.nospam>
| | > | Subject: System.Net.WebC lient.DownloadF ile doesn't work with http
| | > attachments
| | > | Date: Mon, 31 Oct 2005 18:45:48 -0500
| | > | Lines: 35
| | > | X-Priority: 3
| | > | X-MSMail-Priority: Normal
| | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| | > | X-RFC2646: Format=Flowed; Original
| | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| | > | Message-ID: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| | > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| | > | NNTP-Posting-Host: hse-toronto-ppp3484752.symp atico.ca
65.92.97.129
| | > | Path:
TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| | > | Xref: TK2MSFTNGXA01.p hx.gbl
| | > microsoft.publi c.dotnet.langua ges.csharp:1330 60
| | > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| | > |
| | > | Hi,
| | > |
| | > | I have an aspx page at the web server that provides PDF documents
for
| | > smart
| | > | client applications.
| | > |
| | > | Here is the code in aspx page that defines content type:
| | > |
| | > | Response.Conten tType = "applicatio n/octet-stream";
| | > | Response.Append Header("Content-Disposition",
"attachment;fil ename="
+
| | > | fileID.ToString () + ".pdf");
| | > |
| | > | I tested the aspx page by using browser and it works just fine.
| | > |
| | > | Now I need to receive that file by using the
| | > | System.Net.WebC lient.DownloadF ile. The problem is that
DownloadFile
| | > method
| | > | returns the following exception:
| | > |
| | > | "Unable to read data from the transport connection: The connection
was
| | > | closed."
| | > |
| | > | I tested the DownloadFile method to open a direct pdf file like
the
| | > | following statement:
| | > |
| | > | (new
| | > |
| | >
|
System.Net.WebC lient()).Downlo adFile(http://localhost/test.pdf,"c:\\t est.pdf
| | > ");
| | > |
| | > | It works just fine.
| | > |
| | > | How can I use System.Net.WebC lient. DownloadFile to download http
| | > | attachments?
| | > |
| | > | Any help would be apprecited,
| | > | Alan
| | > |
| | > |
| | > |
| | >
| |
| |
| |
|
|

Nov 17 '05 #6
Thanks for your followup.

Glad that you've got it working.
Have a good day!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "A.M-SG" <al******@newsg roup.nospam>
| References: <#N************ **@TK2MSFTNGP12 .phx.gbl>
<CX************ **@TK2MSFTNGXA0 1.phx.gbl>
<#H************ **@tk2msftngp13 .phx.gbl>
<8h************ **@TK2MSFTNGXA0 1.phx.gbl>
<cZ************ **@TK2MSFTNGXA0 1.phx.gbl>
| Subject: Re: System.Net.WebC lient.DownloadF ile doesn't work with http
attachments
| Date: Mon, 7 Nov 2005 09:54:24 -0500
| Lines: 295
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#W************ **@TK2MSFTNGP12 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: Toronto-HSE-ppp3736481.symp atico.ca 67.68.49.178
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:1344 83
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Hi Steven.
|
| Yes, I got it working. Thank you for your help.
|
| Ali
|
|
|
| "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| news:cZ******** ******@TK2MSFTN GXA01.phx.gbl.. .
| > Hi Alan,
| >
| > How are you doing on this issue, have you got any further progress? If
| > there're anything else we can help, please feel free to post here.
Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | X-Tomcat-ID: 66213528
| > | References: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| > <CX************ **@TK2MSFTNGXA0 1.phx.gbl>
| > <#H************ **@tk2msftngp13 .phx.gbl>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: st*****@online. microsoft.com (Steven Cheng[MSFT])
| > | Organization: Microsoft
| > | Date: Wed, 02 Nov 2005 03:37:50 GMT
| > | Subject: Re: System.Net.WebC lient.DownloadF ile doesn't work with http
| > attachments
| > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| > | Message-ID: <8h************ **@TK2MSFTNGXA0 1.phx.gbl>
| > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| > | Lines: 167
| > | Path: TK2MSFTNGXA01.p hx.gbl
| > | Xref: TK2MSFTNGXA01.p hx.gbl
| > microsoft.publi c.dotnet.langua ges.csharp:1333 08
| > | NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
| > |
| > | Hi Alan,
| > |
| > | Yes, I know the serverside code won't have big difference , nor does
the
| > | client code. That's why I think this should be a environment specific
| > | issue. Here is the client code I've used to test , (both use WebClient
| > and
| > | HttpWebRequest ....) , the code work correctly on my test environment.
| > |
| > | =============== ==========
| > | static void Main(string[] args)
| > | {
| > |
| > |
| > | DownloadByWebCl ient();
| > |
| > |
| > | DownloadByHttpW ebRequest();
| > | }
| > |
| > | static void DownloadByWebCl ient()
| > | {
| > | string url =
| > | "http://localhost/StevenRoot/ControlWebApp/filedownload.as px";
| > | string clientfile = @"d:\temp\test_ webclient.pdf";
| > |
| > | WebClient wc = new WebClient();
| > |
| > | wc.DownloadFile (url,clientfile );
| > |
| > | }
| > |
| > | static void DownloadByHttpW ebRequest()
| > | {
| > | string url =
| > | "http://localhost/StevenRoot/ControlWebApp/filedownload.as px";
| > | string clientfile = @"d:\temp\test_ webrequest.pdf" ;
| > |
| > | HttpWebRequest req = WebRequest.Crea te(url) as HttpWebRequest;
| > |
| > | req.Method = "GET";
| > | req.KeepAlive = true;
| > |
| > | HttpWebResponse rep = req.GetResponse () as HttpWebResponse ;
| > |
| > | Stream stream = rep.GetResponse Stream();
| > |
| > | FileStream fs = new FileStream(clie ntfile, FileMode.Create ,
| > | FileAccess.Writ e);
| > |
| > | byte[] buf = new byte[1024];
| > |
| > | int i = 0;
| > |
| > | while( (i=stream.Read( buf,0,buf.Lengt h))> 0)
| > | {
| > | fs.Write(buf,0, i);
| > | }
| > |
| > | fs.Close();
| > |
| > | stream.Close();
| > |
| > | rep.Close();
| > |
| > | }
| > | =============== =============
| > |
| > | In addition, you can also try comment the below line in your
serverside
| > | code to see whether it helps:
| > |
| > | Response.Append Header("Content-Disposition", "attachment;fil ename=" +
| > | fileID.ToString () + ".pdf");
| > |
| > | Thanks,
| > |
| > | Steven Cheng
| > | Microsoft Online Support
| > |
| > | Get Secure! www.microsoft.com/security
| > | (This posting is provided "AS IS", with no warranties, and confers no
| > | rights.)
| > |
| > | --------------------
| > | | From: "A.M-SG" <al******@newsg roup.nospam>
| > | | References: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| > | <CX************ **@TK2MSFTNGXA0 1.phx.gbl>
| > | | Subject: Re: System.Net.WebC lient.DownloadF ile doesn't work with
http
| > | attachments
| > | | Date: Tue, 1 Nov 2005 08:15:42 -0500
| > | | Lines: 124
| > | | X-Priority: 3
| > | | X-MSMail-Priority: Normal
| > | | X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| > | | X-RFC2646: Format=Flowed; Original
| > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| > | | Message-ID: <#H************ **@tk2msftngp13 .phx.gbl>
| > | | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| > | | NNTP-Posting-Host: toronto-hse-ppp4253404.symp atico.ca 70.52.252.114
| > | | Path:
TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| > | | Xref: TK2MSFTNGXA01.p hx.gbl
| > | microsoft.publi c.dotnet.langua ges.csharp:1331 23
| > | | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| > | |
| > | | Hi Steven,
| > | |
| > | | Firstly thank you for your reply.
| > | |
| > | | The code that you provided is not my question.
| > | |
| > | | My question is: "How to receive that pdf file at the client side?"
| > | |
| > | | The server side is done and it is similar to what you mentioned in
| > your
| > | | reply.
| > | |
| > | | I tried to receive the pdf file (test.pdf in your sample) by using
| > | | System.Net.WebC lient.DownloadF ile, but it throws exception.
| > | |
| > | | Regards,
| > | | Alan
| > | |
| > | |
| > | |
| > | | "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| > | | news:CX******** ******@TK2MSFTN GXA01.phx.gbl.. .
| > | | > Hi Alan,
| > | | >
| > | | > Welcome to MSDN newsgroup.
| > | | > Regarding on the file downloading through WebClient class problem
| > you
| > | | > mentioned, seems a bit strange from a general view. It is
possible a
| > | | > machine specific issue. here is a test page's code which could be
| > | | > correctly
| > | | > used (let client user webbrowser or webclient class to download
the
| > | file)
| > | | > on my side:
| > | | >
| > | | > =============== ===
| > | | > private void Page_Load(objec t sender, System.EventArg s e)
| > | | > {
| > | | > Response.ClearH eaders();
| > | | > Response.ClearC ontent();
| > | | > Response.Conten tType = "applicatio n/octet-stream";
| > | | >
| > | | >
| > |
| >
Response.Append Header("Content-Disposition","a ttachment;filen ame=test.pdf");
| > | | >
| > | | > Response.WriteF ile(Server.MapP ath("~/files/test.pdf"));
| > | | >
| > | | > Response.End();
| > | | > }
| > | | > =============== ===
| > | | >
| > | | > You can try the above code in your page to see whether it works.
| > Also,
| > | you
| > | | > can run the webclient from multiple client to see whether it is
| > client
| > | | > specific.
| > | | >
| > | | > Thanks,
| > | | >
| > | | > Steven Cheng
| > | | > Microsoft Online Support
| > | | >
| > | | > Get Secure! www.microsoft.com/security
| > | | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | | > rights.)
| > | | >
| > | | >
| > | | >
| > | | >
| > | | > --------------------
| > | | > | From: "A.M-SG" <al******@newsg roup.nospam>
| > | | > | Subject: System.Net.WebC lient.DownloadF ile doesn't work with
http
| > | | > attachments
| > | | > | Date: Mon, 31 Oct 2005 18:45:48 -0500
| > | | > | Lines: 35
| > | | > | X-Priority: 3
| > | | > | X-MSMail-Priority: Normal
| > | | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | | > | X-RFC2646: Format=Flowed; Original
| > | | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | | > | Message-ID: <#N************ **@TK2MSFTNGP12 .phx.gbl>
| > | | > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| > | | > | NNTP-Posting-Host: hse-toronto-ppp3484752.symp atico.ca
| > 65.92.97.129
| > | | > | Path:
| > TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| > | | > | Xref: TK2MSFTNGXA01.p hx.gbl
| > | | > microsoft.publi c.dotnet.langua ges.csharp:1330 60
| > | | > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| > | | > |
| > | | > | Hi,
| > | | > |
| > | | > | I have an aspx page at the web server that provides PDF
documents
| > for
| > | | > smart
| > | | > | client applications.
| > | | > |
| > | | > | Here is the code in aspx page that defines content type:
| > | | > |
| > | | > | Response.Conten tType = "applicatio n/octet-stream";
| > | | > | Response.Append Header("Content-Disposition",
| > "attachment;fil ename="
| > +
| > | | > | fileID.ToString () + ".pdf");
| > | | > |
| > | | > | I tested the aspx page by using browser and it works just fine.
| > | | > |
| > | | > | Now I need to receive that file by using the
| > | | > | System.Net.WebC lient.DownloadF ile. The problem is that
| > DownloadFile
| > | | > method
| > | | > | returns the following exception:
| > | | > |
| > | | > | "Unable to read data from the transport connection: The
connection
| > was
| > | | > | closed."
| > | | > |
| > | | > | I tested the DownloadFile method to open a direct pdf file like
| > the
| > | | > | following statement:
| > | | > |
| > | | > | (new
| > | | > |
| > | | >
| > |
| >
System.Net.WebC lient()).Downlo adFile(http://localhost/test.pdf,"c:\\t est.pdf
| > | | > ");
| > | | > |
| > | | > | It works just fine.
| > | | > |
| > | | > | How can I use System.Net.WebC lient. DownloadFile to download
http
| > | | > | attachments?
| > | | > |
| > | | > | Any help would be apprecited,
| > | | > | Alan
| > | | > |
| > | | > |
| > | | > |
| > | | >
| > | |
| > | |
| > | |
| > |
| > |
| >
|
|
|

Nov 17 '05 #7

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

Similar topics

4
15520
by: Justin Malloy | last post by:
I am using the System.Net.Webclient to try and download an XML file from a website but am receiving a HTTP protocol error when running the DownloadFile() sub routine. I did a HTTP trace using internet explorer to see what is happening in the request and it looks as though the request originates using HTTP/1.1 to an IIS server authenticates itself but ultimately gets executed by a Java Application server and when the request is fulfilled...
1
4268
by: James Write | last post by:
Hi, I am using the webclient.downloadfile() method to download a file from a remote web server to the local harddrive. public CopyFile(string sSrcPath, string sDestPath) { WebClient oClient = new WebClient(); oClient.DownloadFile(sSrcPath,sDestPath); }
0
2431
by: pascal_dumont | last post by:
Hi all, I have a problem with downloading files by using WebClient wc = new WebClient(); wc.DownloadFile("http://some_url.com/some_file.gif", "some_file.gif"); This returns the error 403 from the server but I can access this files from Internet Explorer without any problems. To further complicate matters this error shows only up at work but works on my home PC.
5
4031
by: Vitling | last post by:
For no apparent reason, a NullReference exception is thrown in system.dll (System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback). Since I only get a disassembly from Visual Studio, it is almost impossible to figure out what causes this. I've tried adding: AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler (SystemErrorHandler); to my main method, and a handler function:
8
9013
by: DEWright_CA | last post by:
Why does WebClient.DownloadFile loose my completed path? Ok, I have a function in my app then when my button is clicked it checks to see if the files come from a local drive or a http address. The portion of the code that pulls from the drive works great, but when the http address is active it changes the originating path to my C:\Windows\System32 folder instead of the proper path. I keep the path as a field on my form so I am certain...
1
2925
by: peter.rietmann | last post by:
I have been suddenly having a performance problem downloading images from one server (productive) to another (productive) using the following code .. WebClient webClient = new WebClient(); try { webClient.DownloadFile(sourceUrlFilename, destinationFilename); } catch (Exception ex)
1
4975
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=test.pdf");
1
12491
by: Mike | last post by:
I am using PowerShell to download an XML file into a string using the DownloadString(URI) method of System.Net.WebClient object. Sample commands below: $Result = $Null; $WebClient = new-object System.Net.WebClient; $WebClient.Encoding = ::Default; $WebClient.Proxy = ::DefaultWebProxy; $WebClient.Proxy.Credentials = ::DefaultCredentials;
8
9519
by: =?Utf-8?B?UnVpIE9saXZlaXJh?= | last post by:
WebClient.DownloadFile I am using the WebClient.DownloadFile function to download a file from server to a local client. When I execute the below code, file is created in server and not in client. What am I doing wrong?
0
8773
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
9276
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
9145
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
9042
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,...
1
6613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5935
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4442
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
4705
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2495
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.