public void ProcessRequest(HttpContext context) { String sFullPath = String.Empty; sFullPath = context.Request.QueryString["FullPath"]; if (sFullPath != null && sFullPath.Length > 4) { if (sFullPath.Contains(@"\")) { try { FileInfo _fileInfo = new FileInfo(sFullPath); if (_fileInfo.Exists) { // Clear the whatever context.Response.Buffer = false; context.Response.Clear(); String sContentType = ""; // Determine the content type switch (_fileInfo.Extension.ToLower()) { case ".dwf": sContentType = "Application/x-dwf"; break; case ".pdf": sContentType = "Application/pdf"; break; case ".doc": sContentType = "Application/vnd.ms-word"; break; case ".ppt": case ".pps": sContentType = "Application/vnd.ms-powerpoint"; break; case ".xls": sContentType = "Application/vnd.ms-excel"; break; default: // Catch-all content type, let the browser figure it out sContentType = "Application/octet-stream"; break; } // Set the headers ??? don't ask context.Response.AddHeader("Content-Disposition", "filename=" + _fileInfo.Name); context.Response.AddHeader("Content-Length", _fileInfo.Length.ToString()); // Set the content type context.Response.ContentType = sContentType; // Write the file to the browser context.Response.WriteFile(sFullPath); } } catch (Exception ex) { } } } }