<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Getting Started</title><link>http://forums.asp.net/15.aspx</link><description>The perfect forum for ASP.NET novices. No question too simple! &lt;A href="http://aspadvice.com/SignUp/list.aspx?l=21&amp;amp;c=17" target=_blank&gt;Email List&lt;/A&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Download</title><link>http://forums.asp.net/thread/2069557.aspx</link><pubDate>Thu, 20 Dec 2007 03:50:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2069557</guid><dc:creator>cafeasp</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2069557.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2069557</wfw:commentRss><description>&lt;p&gt;Very nice code &lt;font face="Verdana"&gt;&lt;font color="#ff0000"&gt;K&lt;/font&gt;&lt;font color="green"&gt;a&lt;/font&gt;&lt;font color="blue"&gt;u&lt;/font&gt;&lt;font color="magenta"&gt;s&lt;/font&gt;&lt;font color="purple"&gt;h&lt;/font&gt;&lt;font color="#0a00b0"&gt;a&lt;/font&gt;&lt;font color="red"&gt;L&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: Download</title><link>http://forums.asp.net/thread/2069393.aspx</link><pubDate>Thu, 20 Dec 2007 01:41:10 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2069393</guid><dc:creator>SlackmasterK</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2069393.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2069393</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;kaushalparik27:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;here is the referenced link.. 
&lt;p&gt;&lt;a href="http://blog.damnednice.com/?Req=Post&amp;amp;PID=187"&gt;Programmatically Download File from Remote Location to User Through Server&lt;/a&gt; &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;[...]&lt;/p&gt;
&lt;p&gt;&amp;nbsp;working fine for me...&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;hope it helps./.&amp;nbsp;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;W00t, my site got referenced! I saw an incoming click and referenced back here. Hope it helps.&lt;/p&gt;</description></item><item><title>Re: Download</title><link>http://forums.asp.net/thread/2066422.aspx</link><pubDate>Tue, 18 Dec 2007 17:52:40 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2066422</guid><dc:creator>vallamreddy123</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2066422.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2066422</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I should say that i am very much thankful to u.&lt;/p&gt;
&lt;p&gt;This code helped me alot.&lt;/p&gt;
&lt;p&gt;ThankU &lt;strong&gt;kaushalparik.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Regards,&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Vallamreddy VenuGopal&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Re: Download</title><link>http://forums.asp.net/thread/2063910.aspx</link><pubDate>Mon, 17 Dec 2007 16:39:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2063910</guid><dc:creator>Haissam</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2063910.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2063910</wfw:commentRss><description>&lt;p&gt;Check below link&lt;/p&gt;&lt;p&gt;&lt;a href="http://dotnetslackers.com/community/blogs/haissam/archive/2007/04/03/Downloading-Files-C_2300_.aspx" target="_blank"&gt;Download files in asp.net&lt;/a&gt;&lt;/p&gt;&lt;p&gt;HC&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Download</title><link>http://forums.asp.net/thread/2063361.aspx</link><pubDate>Mon, 17 Dec 2007 12:01:43 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2063361</guid><dc:creator>kaushalparik27</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2063361.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2063361</wfw:commentRss><description>&lt;p&gt;here is the referenced link..&lt;/p&gt;&lt;p&gt;&lt;a href="http://blog.damnednice.com/?Req=Post&amp;amp;PID=187"&gt;Programmatically Download File from Remote Location to User Through Server&lt;/a&gt; &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Data;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Configuration;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.Security;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.UI;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.UI.WebControls;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.UI.WebControls.WebParts;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Web.UI.HtmlControls;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Data.SqlClient;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Data.Sql;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.Net;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.IO;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwd"&gt;public&lt;/span&gt; partial &lt;span class="kwd"&gt;class&lt;/span&gt; _Default : System.Web.UI.Page &lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwd"&gt;protected void&lt;/span&gt; Page_Load(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="cmt"&gt;//base.OnLoad(e);&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwd"&gt;string&lt;/span&gt; url = &lt;span class="kwd"&gt;string&lt;/span&gt;.Empty;&lt;span class="cmt"&gt;// Request.QueryString[&amp;quot;DownloadUrl&amp;quot;];&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwd"&gt;if&lt;/span&gt; (url == &lt;span class="kwd"&gt;null&lt;/span&gt; || url.Length == 0)&lt;br /&gt;        {&lt;br /&gt;            url = &lt;span class="st"&gt;&amp;quot;http:&lt;span class="cmt"&gt;//img444.imageshack.us/img444/6228/initialgridsq7.jpg&amp;quot;;&lt;/span&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span class="cmt"&gt;//Initialize the input stream&lt;/span&gt;&lt;br /&gt;        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);&lt;br /&gt;        HttpWebResponse resp = (HttpWebResponse)req.GetResponse();&lt;br /&gt;        int bufferSize = 1;&lt;br /&gt;&lt;br /&gt;        &lt;span class="cmt"&gt;//Initialize the output stream&lt;/span&gt;&lt;br /&gt;        Response.Clear();&lt;br /&gt;        Response.AppendHeader(&amp;quot;&lt;/span&gt;Content-Disposition:&lt;span class="st"&gt;&amp;quot;, &amp;quot;&lt;/span&gt;attachment; filename=download.jpg&lt;span class="st"&gt;&amp;quot;);&lt;br /&gt;        Response.AppendHeader(&amp;quot;&lt;/span&gt;Content-Length&lt;span class="st"&gt;&amp;quot;, resp.ContentLength.ToString());&lt;br /&gt;        Response.ContentType = &amp;quot;&lt;/span&gt;application/download&amp;quot;;&lt;br /&gt;&lt;br /&gt;        &lt;span class="cmt"&gt;//Populate the output stream&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwd"&gt;byte&lt;/span&gt;[] ByteBuffer = &lt;span class="kwd"&gt;new byte&lt;/span&gt;[bufferSize + 1];&lt;br /&gt;        MemoryStream ms = &lt;span class="kwd"&gt;new&lt;/span&gt; MemoryStream(ByteBuffer, &lt;span class="kwd"&gt;true&lt;/span&gt;);&lt;br /&gt;        Stream rs = req.GetResponse().GetResponseStream();&lt;br /&gt;        &lt;span class="kwd"&gt;byte&lt;/span&gt;[] bytes = &lt;span class="kwd"&gt;new byte&lt;/span&gt;[bufferSize + 1];&lt;br /&gt;        &lt;span class="kwd"&gt;while&lt;/span&gt; (rs.Read(ByteBuffer, 0, ByteBuffer.Length) &amp;gt; 0)&lt;br /&gt;        {&lt;br /&gt;            Response.BinaryWrite(ms.ToArray());&lt;br /&gt;            Response.Flush();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span class="cmt"&gt;//Cleanup&lt;/span&gt;&lt;br /&gt;        Response.End();&lt;br /&gt;        ms.Close();&lt;br /&gt;        ms.Dispose();&lt;br /&gt;        rs.Dispose();&lt;br /&gt;        ByteBuffer = &lt;span class="kwd"&gt;null&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;working fine for me...&lt;br /&gt;&lt;p&gt;hope it helps./.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Download</title><link>http://forums.asp.net/thread/2063285.aspx</link><pubDate>Mon, 17 Dec 2007 10:54:09 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2063285</guid><dc:creator>vallamreddy123</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2063285.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2063285</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Does anybody have code to download a file from the remote server using C#.net.&lt;/p&gt;
&lt;p&gt;I have a code that downloads a file with in the the local system. given below.&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; path = &amp;quot;File path comes here&amp;quot;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;System.IO.&lt;/font&gt;&lt;font color="#008080" size="2"&gt;FileInfo&lt;/font&gt;&lt;font size="2"&gt; file = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; System.IO.&lt;/font&gt;&lt;font color="#008080" size="2"&gt;FileInfo&lt;/font&gt;&lt;font size="2"&gt;(path); &lt;/font&gt;&lt;font color="#008000" size="2"&gt;//get file object as FileInfo &lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;font size="2"&gt; (file.Exists) &lt;/font&gt;&lt;font color="#008000" size="2"&gt;//-- if the file exists on the server &lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;Response.Clear(); &lt;/font&gt;&lt;font color="#008000" size="2"&gt;//set appropriate headers &lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;Response.AddHeader(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;Content-Disposition&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;attachment; filename=&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; + file.Name);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;Response.AddHeader(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;Content-Length&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, file.Length.ToString());&lt;/p&gt;Response.ContentType = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;application/....&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;Response.WriteFile(file.FullName);&lt;/p&gt;
&lt;p&gt;Response.End(); &lt;/font&gt;&lt;font color="#008000" size="2"&gt;//if file does not exist &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#008000" size="2"&gt;&amp;nbsp;&lt;/font&gt;but my requirement is to download a file from the remote server&lt;font color="#008000" size="2"&gt;&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>