Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Sat, 28 Jun 2008 12:47:00 -0700,    group: microsoft.public.win32.programmer.directx.managed        back       


Mobile Forms File Download   
File download works on my local machine, but after I move to windows server 
2003 and run from my development machine (XP) the file download returns error:

Internet explorer cannot download

Here is the code:
 FileStream MyFileStream = null;
            
            try
            {
                string sPath = "";
                //sPath = HttpContext.Current.Server.MapPath(path);
                
                MyFileStream = new FileStream(path + @"\" + filename, 
FileMode.Open);
                long FileSize;
                FileSize = MyFileStream.Length;

                

                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.ClearContent();
                HttpContext.Current.Response.ClearHeaders();


                byte[] Buffer = new byte[(int)FileSize];
                MyFileStream.Read(Buffer, 0, (int)MyFileStream.Length);
               // MyFileStream.Close();
                string sDocType = "";

                switch (ext)
                {
                    case "doc":
                       sDocType = "Application/vnd.ms-word";
                        break;
                    case "pdf":
                        sDocType = "application/pdf";
                        break;
                    case "xls":
                        sDocType = "application/vnd.ms-excel";
                        break;
                }
                HttpContext.Current.Response.ContentType = sDocType;
                HttpContext.Current.Response.AddHeader("Content-Length", 
FileSize.ToString());
                
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; 
filename=" + filename);

                HttpContext.Current.Response.Write(Buffer);
date: Sat, 28 Jun 2008 12:47:00 -0700   author:   David B David

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us