コード例 #1
0
        public void Process(System.Web.HttpResponse response)
        {
            response.AddHeader("Content-Disposition", "attachment;filename=" + Path.GetFileName(_filePath));
            response.AddHeader("Content-Transfer-Encoding", "binary");
            response.ContentType = "application/octet-stream";
            response.Cache.SetCacheability(HttpCacheability.NoCache);

            if (_filePath.StartsWith("http"))
            {
                System.Net.WebClient net = new System.Net.WebClient();

                var file = net.DownloadData(_filePath);

                response.BinaryWrite(file);

                response.End();


            }
            else
            {
                response.WriteFile(_filePath);
            }


        }
コード例 #2
0
ファイル: Export.cs プロジェクト: hacikaraa/Goldepus
        public static void ExportToCsv(System.Web.HttpResponse response, DataTable exportData, string exportName)
        {
            response.Clear();
            byte[] BOM = { 0xEF, 0xBB, 0xBF }; // UTF-8 BOM karakterleri
            response.BinaryWrite(BOM);
            StringBuilder sb = new StringBuilder();
            foreach (DataColumn dc in exportData.Columns)
            {
                sb.Append((char)(34) + dc.ColumnName + (char)(34));
                sb.Append(";");
            }
            sb = sb.Remove(sb.Length - 1, 1);
            sb.AppendLine();
            foreach (DataRow dr in exportData.Rows)
            {

                for (int i = 0; i < exportData.Columns.Count; i++)
                {
                    sb.Append(dr[i].ToString().Replace(';', ',').Replace('\n', ' ').Replace('\t', ' ').Replace('\r', ' '));
                    sb.Append(";");
                }
                sb = sb.Remove(sb.Length - 1, 1);
                sb.AppendLine();
            }
            response.ContentType = "text/csv";
            response.AppendHeader("Content-Disposition", "attachment; filename=" + exportName + ".csv");
            response.Write(sb.ToString());
            response.End();
        }
コード例 #3
0
 public static void Convert(System.Data.DataSet ds, int TableIndex, System.Web.HttpResponse response, string ExcelName)
 {
     //lets make sure a table actually exists at the passed in value
     //if it is not call the base method
     if (TableIndex > ds.Tables.Count - 1)
     {
         Convert(ds, response, ExcelName);
     }
     //we've got a good table so
     //let's clean up the response.object
     response.Clear();
     response.Charset = "";
     response.AddHeader("Content-Disposition", "attachment;filename=Shilpa.xls");
     //set the response mime type for excel
     response.ContentType = "application/vnd.ms-excel";
     //create a string writer
     System.IO.StringWriter stringWrite = new System.IO.StringWriter();
     //create an htmltextwriter which uses the stringwriter
     System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
     //instantiate a datagrid
     System.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid();
     //set the datagrid datasource to the dataset passed in
     dg.DataSource = ds.Tables[TableIndex];
     //bind the datagrid
     dg.DataBind();
     //tell the datagrid to render itself to our htmltextwriter
     dg.RenderControl(htmlWrite);
     //all that's left is to output the html
     response.Write(stringWrite.ToString());
     response.End();
 }
コード例 #4
0
    public static void Convert(System.Data.DataSet ds, System.Web.HttpResponse response, string ExcelName)
    {
        try
        {
            //first let's clean up the response.object
            response.Clear();
            response.Charset = "";
            //set the response mime type for excel

            response.ContentType = "application/vnd.ms-excel";
            //create a string writer
            //response.AddHeader("Content-Disposition", "attachment;filename=Shilpa.xls");

            response.AddHeader("Content-Disposition", "attachment;filename=" + ExcelName + ".xls");

            System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            //create an htmltextwriter which uses the stringwriter
            System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
            //instantiate a datagrid
            System.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid();
            //set the datagrid datasource to the dataset passed in
            dg.DataSource = ds.Tables[0];
            //bind the datagrid
            dg.DataBind();
            //tell the datagrid to render itself to our htmltextwriter
            dg.RenderControl(htmlWrite);
            //all that's left is to output the html
            response.Write(stringWrite.ToString());
            response.End();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #5
0
ファイル: Module.cs プロジェクト: aquamoth/Scrutiny
		private static void endResponse(System.Web.HttpResponse response, string responseText, System.Net.HttpStatusCode statusCode = System.Net.HttpStatusCode.OK)
		{
#warning Unbuffered responses can probably set status code if NO content has been sent yet?!
			if (response.Buffer)
				response.StatusCode = (int)statusCode;
			response.Write(responseText);
			response.End();
		}
コード例 #6
0
 protected override void WriteFile(System.Web.HttpResponseBase response)
 {
     response.Clear();
     response.AddHeader("content-disposition", "attachment; filename=" + DownloadedFilename);
     response.ContentType = this.ContentType;
     response.WriteFile(Path);
     response.Flush();
     System.IO.File.Delete(Path);
     response.End();
 }
コード例 #7
0
 /// <summary>
 /// 把DataTable导出为Word文件
 /// </summary>
 /// <param name="page">Page</param>
 /// <param name="fileName">Word文件名(不包括后缀*.doc)</param>
 /// <param name="dtbl">将要被导出的DataTable对象</param>
 /// <returns></returns>
 public static bool DataTableToWord(System.Web.HttpResponse response, string fileName, DataTable dtbl)
 {
     response.Clear();
     response.Buffer = true;
     response.Charset = "UTF-8";
     response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName + ".doc");
     response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
     response.ContentType = "application/ms-word";
     //page.EnableViewState = false;
     response.Write(DataTableToHtmlTable(dtbl));
     response.End();
     return true;
 }
コード例 #8
0
ファイル: ExcelHelper.cs プロジェクト: sinaaslani/kids.bmi.ir
        public static bool SaveAs(System.Web.HttpResponse Response, string FullFilePath)
        {
            try
            {
                FileInfo myfile = new FileInfo(FullFilePath);

                if (myfile.Exists)
                {
                    Response.ClearContent();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + myfile.Name);
                    Response.AddHeader("Content-Length", myfile.Length.ToString());
                    Response.ContentType = "application/vnd.ms-excel";
                    Response.WriteFile(myfile.FullName);
                    Response.End();

                }
                return true;
            }
            catch (ThreadAbortException) { return false; }

        }
コード例 #9
0
        public static bool Render(System.Web.HttpResponseBase Response, 
            Excel.IWorkbookBase workbook, string fileName)
        {
            // AiLib.Report.Excel.IWorkbookBase workbook

            // http://dotnetslackers.com/articles/aspnet/Create-Excel-Spreadsheets-Using-NPOI.aspx
            // Save the Excel spreadsheet to a MemoryStream and return it to the client

            using (var exportData = new MemoryStream())
            {
                workbook.Write(exportData);

                string saveAsFileName = fileName;
                Response.ContentType = ContentExcel;
                Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", saveAsFileName));
                Response.Clear();
                Response.BinaryWrite(exportData.GetBuffer());
                Response.End();
            }

            return true;
        }
コード例 #10
0
ファイル: ExcelUtil.cs プロジェクト: ZengYuming/TNS
        public static void ToExcel(DataTable dataTable, System.Web.HttpResponseBase response)
        {
            using (StringWriter sw = new StringWriter())
            {
                List<string> headers = getTableHeaders(dataTable);
                string sHeaders = getHeadersString(headers);

                sw.WriteLine(sHeaders);

                foreach (DataRow dr in dataTable.Rows)
                {
                    string sRow = getRowString(dr, headers);
                    sw.WriteLine(sRow);
                }

                response.Clear();
                response.Buffer = true;
                response.AddHeader("Content-Disposition", "attachment;filename=Teest.xls");
                response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
                response.ContentType = "application/vnd.ms-excel";
                response.Write(sw);
                response.End();
            }
        }
コード例 #11
0
ファイル: Util.cs プロジェクト: eagledu/wedding
 public static void Display(System.Web.HttpResponse response, COMMON.ByteMatrix matrix, System.Drawing.Imaging.ImageFormat format, bool isAppendImage)
 {
     response.ClearContent();
     response.ContentType = "image/Jpeg";
     response.BinaryWrite(GetBytes(matrix, format, isAppendImage));
     response.End();
 }
コード例 #12
0
		public override void SendResponse( System.Web.HttpResponse response )
		{
			this.CheckConnector();

			try
			{
				this.CheckRequest();
			}
			catch ( ConnectorException connectorException )
			{
				response.AddHeader( "X-CKFinder-Error", ( connectorException.Number ).ToString() );
				response.StatusCode = 403;
				response.End();
				return;
			}
			catch
			{
				response.AddHeader( "X-CKFinder-Error", ( (int)Errors.Unknown ).ToString() );
				response.StatusCode = 403;
				response.End();
				return;
			}

			if ( !Config.Current.Thumbnails.Enabled )
			{
				response.AddHeader( "X-CKFinder-Error", ((int)Errors.ThumbnailsDisabled).ToString() );
				response.StatusCode = 403;
				response.End();
				return;
			}

			if ( !this.CurrentFolder.CheckAcl( AccessControlRules.FileView ) )
			{
				response.AddHeader( "X-CKFinder-Error", ( (int)Errors.Unauthorized ).ToString() );
				response.StatusCode = 403;
				response.End();
				return;
			}

			bool is304 = false;

			string fileName = HttpContext.Current.Request[ "FileName" ];

			string thumbFilePath = System.IO.Path.Combine( this.CurrentFolder.ThumbsServerPath, fileName );

			if ( !Connector.CheckFileName( fileName ) )
			{
				response.AddHeader( "X-CKFinder-Error", ( (int)Errors.InvalidRequest ).ToString() );
				response.StatusCode = 403;
				response.End();
				return;
			}

			if ( Config.Current.CheckIsHiddenFile( fileName ) )
			{
				response.AddHeader( "X-CKFinder-Error", ( (int)Errors.FileNotFound ).ToString() + " - Hidden folder" );
				response.StatusCode = 404;
				response.End();
				return;
			}

			// If the thumbnail file doesn't exists, create it now.
			if ( !System.IO.File.Exists( thumbFilePath ) )
			{
				string sourceFilePath = System.IO.Path.Combine( this.CurrentFolder.ServerPath, fileName );

				if ( !System.IO.File.Exists( sourceFilePath ) )
				{
					response.AddHeader( "X-CKFinder-Error", ( (int)Errors.FileNotFound ).ToString() );
					response.StatusCode = 404;
					response.End();
					return;
				}

				ImageTools.ResizeImage( sourceFilePath, thumbFilePath, Config.Current.Thumbnails.MaxWidth, Config.Current.Thumbnails.MaxHeight, true, Config.Current.Thumbnails.Quality );
			}

			System.IO.FileInfo thumbfile = new System.IO.FileInfo( thumbFilePath ) ;

			if ( !thumbfile.Exists )
			{
				response.AddHeader("X-CKFinder-Error", ((int)Errors.Unknown).ToString());
				response.StatusCode = 404;
				response.End();
				return;
			}
			string eTag = thumbfile.LastWriteTime.Ticks.ToString("X") + "-" + thumbfile.Length.ToString("X");

			string chachedETag = Request.ServerVariables[ "HTTP_IF_NONE_MATCH" ];
			if ( chachedETag != null && chachedETag.Length > 0 && eTag == chachedETag )
			{
				is304 = true ;
			}

			if ( !is304 )
			{
				string cachedTimeStr = Request.ServerVariables[ "HTTP_IF_MODIFIED_SINCE" ];
				if ( cachedTimeStr != null && cachedTimeStr.Length > 0 )
				{
					try
					{
						DateTime cachedTime = DateTime.Parse( cachedTimeStr );

						if ( cachedTime >= thumbfile.LastWriteTime )
							is304 = true;
					}
					catch
					{
						is304 = false;
					}
				}
			}

			if ( is304 )
			{
				response.StatusCode = 304;
				response.End();
				return;
			}

			string thumbFileExt = System.IO.Path.GetExtension( thumbFilePath ).TrimStart( '.' ).ToLower() ;

			if ( thumbFilePath == ".jpg" )
				response.ContentType = "image/jpeg";
			else
				response.ContentType = "image/" + thumbFileExt;

			response.Cache.SetETag( eTag );
			response.Cache.SetLastModified( thumbfile.LastWriteTime );
			response.Cache.SetCacheability( HttpCacheability.Private );

			response.WriteFile( thumbFilePath );
		}
コード例 #13
0
        public static void DownloadFile(System.Web.HttpResponse objResponse, string strFileName, byte[] FileBytes, string strExtension, bool bPromptForDownload)
        {
            string strType = "";

            //Set Content Type for Response
            if (strExtension.LastIndexOf(".") > -1)
            {
                strExtension = strExtension.Substring(strExtension.LastIndexOf(".") + 1);
            }
            switch (strExtension)
            {
                case "Xml":
                    strType = "text/Xml";
                    break;
                case "htm":
                    strType = "text/HTML";
                    break;
                case "html":
                    strType = "text/HTML";
                    break;
                case "txt":
                    strType = "text/plain";
                    break;
                case "json":
                    strType = "application/json";
                    break;
                case "pdf":
                    strType = "application/pdf";
                    break;
                case "xls":
                    strType = "application/vnd.ms-excel";
                    break;
                case "rtf":
                    strType = "application/rtf";
                    break;
                case "xhtml":
                    strType = "text/xhtml";
                    break;
                case "asp":
                    strType = "text/asp";
                    break;
                //audio file types
                case "wav":
                    strType = "audio/x-wav";
                    break;
                case "mpg":
                    strType = "audio/mpeg";
                    break;
                case "mp3":
                    strType = "audio/mpeg3";
                    break;
                case "wmv":
                    strType = "audio/x-ms-wmv";
                    break;
                //image file types
                case "gif":
                    strType = "image/gif";
                    break;
                case "jpg":
                    strType = "image/jpeg";
                    break;
                case "jpeg":
                    strType = "image/jpeg";
                    break;
                case "png":
                    strType = "image/png";
                    break;
                //video file types
                case "avi":
                    strType = "video/avi";
                    break;
                case "dat":
                    strType = "video/mpeg";
                    break;
                case "mov":
                    strType = "video/quicktime";
                    break;
                case "mpeg":
                    strType = "video/mpeg";
                    break;
                default:
                    //Handle All Other Files
                    strType = "application/octet-stream";
                    break;
            }

            if ((strExtension != null))
            {
                objResponse.Clear();

                objResponse.Buffer = false;

                objResponse.ContentType = strType;

                //ensure when building the file name that all forbidden

                //file name characters are replaced with
                if (bPromptForDownload)
                {
                    objResponse.AddHeader("content-disposition", "attachment; filename=" + strFileName + "." + strExtension);
                }
                else
                {
                    objResponse.AddHeader("content-disposition", "filename=" + strFileName + "." + strExtension);
                }

                objResponse.AddHeader("Content-Length", Convert.ToString(FileBytes.Length));

                objResponse.BinaryWrite(FileBytes);

                objResponse.Flush();

                objResponse.End();
            }
        }
コード例 #14
0
ファイル: ExportXls.cs プロジェクト: unie/TestGitF
        public void ExportEvReportToxls(System.Web.HttpResponse Response, string filename, Guid courseId)
        {
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", System.Web.HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8)));
            Response.Clear();

            InitializeWorkbook();
            GenerateEvReportData(courseId);
            GetExcelStream().WriteTo(Response.OutputStream);
            Response.End();
        }
コード例 #15
0
        // calls SetupResponse to set header and cache and saves Excel file to HttpResponse
        protected internal void SaveExcelBook(System.Web.HttpResponse response)
        {
            try
            {
                ISDExcelBook.Save(response.OutputStream, response);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            // Need to call Response.End() so nothing will be attached to a file
            // System.Web.HttpResponse.End() function will throw System.Threading.ThreadAbortException
            // indicating that the current response ends prematurely - that's what we want
            response.End();
        }
コード例 #16
0
        public override void SendResponse( System.Web.HttpResponse response )
        {
            int iErrorNumber = 0;
            string sFileName = "";
            string sFilePath = "";
            string sUnsafeFileName = "";

            try
            {
                this.CheckConnector();
                this.CheckRequest();

                if ( !this.CurrentFolder.CheckAcl( AccessControlRules.FileUpload ) )
                {
                    ConnectorException.Throw( Errors.Unauthorized );
                }

                HttpPostedFile oFile = null;
                if ( HttpContext.Current.Request.Files["upload"] != null )
                {
                    oFile = HttpContext.Current.Request.Files["upload"];
                }
                else if ( HttpContext.Current.Request.Files["NewFile"] != null )
                {
                    oFile = HttpContext.Current.Request.Files["NewFile"];
                }
                else if ( HttpContext.Current.Request.Files.AllKeys.Length > 0 )
                {
                    oFile = HttpContext.Current.Request.Files[HttpContext.Current.Request.Files.AllKeys[0]];
                }

                if ( oFile != null )
                {
                    int iPathIndex = oFile.FileName.LastIndexOf( "\\" );
                    sFileName = ( iPathIndex >= 0  && oFile.FileName.Length > 1 ) ? oFile.FileName.Substring( iPathIndex + 1 ) : oFile.FileName;

                    if ( Config.Current.CheckDoubleExtension )
                        sFileName = this.CurrentFolder.ResourceTypeInfo.ReplaceInvalidDoubleExtensions( sFileName );

                    sUnsafeFileName = sFileName;

                    if ( Config.Current.DisallowUnsafeCharacters )
                        sFileName = sFileName.Replace(";","_");

                    // Replace dots in the name with underscores (only one dot can be there... security issue).
                    if ( Config.Current.ForceSingleExtension )
                        sFileName = Regex.Replace( sFileName, @"\.(?![^.]*$)", "_", RegexOptions.None );

                    if ( sFileName != sUnsafeFileName )
                        iErrorNumber = Errors.UploadedInvalidNameRenamed;

                    if ( Connector.CheckFileName( sFileName ) && !Config.Current.CheckIsHiddenFile( sFileName ) )
                    {
                        if ( !Config.Current.CheckSizeAfterScaling && this.CurrentFolder.ResourceTypeInfo.MaxSize > 0 && oFile.ContentLength > this.CurrentFolder.ResourceTypeInfo.MaxSize )
                            ConnectorException.Throw( Errors.UploadedTooBig );

                        string sExtension = System.IO.Path.GetExtension( sFileName );
                        sExtension = sExtension.TrimStart( '.' );

                        if ( !this.CurrentFolder.ResourceTypeInfo.CheckExtension( sExtension ) )
                            ConnectorException.Throw( Errors.InvalidExtension );

                        if ( Config.Current.CheckIsNonHtmlExtension( sExtension ) && !this.CheckNonHtmlFile( oFile ) )
                            ConnectorException.Throw( Errors.UploadedWrongHtmlFile );

                        // Map the virtual path to the local server path.
                        string sServerDir = this.CurrentFolder.ServerPath;

                        string sFileNameNoExt = CKFinder.Connector.Util.GetFileNameWithoutExtension( sFileName );
                        string sFullExtension = CKFinder.Connector.Util.GetExtension( sFileName );
                        int iCounter = 0;

                        // System.IO.File.Exists in C# does not return true for protcted files
                        if ( Regex.IsMatch( sFileNameNoExt, @"^(AUX|COM\d|CLOCK\$|CON|NUL|PRN|LPT\d)$", RegexOptions.IgnoreCase ) )
                        {
                            iCounter++;
                            sFileName = sFileNameNoExt + "(" + iCounter + ")" + sFullExtension;
                            iErrorNumber = Errors.UploadedFileRenamed;
                        }

                        while ( true )
                        {
                            sFilePath = System.IO.Path.Combine( sServerDir, sFileName );

                            if ( System.IO.File.Exists( sFilePath ) )
                            {
                                iCounter++;
                                sFileName = sFileNameNoExt + "(" + iCounter + ")" + sFullExtension;
                                iErrorNumber = Errors.UploadedFileRenamed;
                            }
                            else
                            {
                                oFile.SaveAs( sFilePath );

                                if ( Config.Current.SecureImageUploads && ImageTools.IsImageExtension( sExtension ) && !ImageTools.ValidateImage( sFilePath ) )
                                {
                                    System.IO.File.Delete( sFilePath );
                                    ConnectorException.Throw( Errors.UploadedCorrupt );
                                }

                                Settings.Images imagesSettings = Config.Current.Images;

                                if ( imagesSettings.MaxHeight > 0 && imagesSettings.MaxWidth > 0 )
                                {
                                    ImageTools.ResizeImage( sFilePath, sFilePath, imagesSettings.MaxWidth, imagesSettings.MaxHeight, true, imagesSettings.Quality );

                                    if ( Config.Current.CheckSizeAfterScaling && this.CurrentFolder.ResourceTypeInfo.MaxSize > 0 )
                                    {
                                        long fileSize = new System.IO.FileInfo( sFilePath ).Length;
                                        if ( fileSize > this.CurrentFolder.ResourceTypeInfo.MaxSize )
                                        {
                                            System.IO.File.Delete( sFilePath );
                                            ConnectorException.Throw( Errors.UploadedTooBig );
                                        }
                                    }
                                }

                                break;
                            }
                        }
                    }
                    else
                        ConnectorException.Throw( Errors.InvalidName );
                }
                else
                    ConnectorException.Throw( Errors.UploadedCorrupt );
            }
            catch ( ConnectorException connectorException )
            {
                iErrorNumber = connectorException.Number;
            }
            catch ( System.Security.SecurityException )
            {
            #if DEBUG
                throw;
            #else
                iErrorNumber = Errors.AccessDenied;
            #endif
            }
            catch ( System.UnauthorizedAccessException )
            {
            #if DEBUG
                throw;
            #else
                iErrorNumber = Errors.AccessDenied;
            #endif
            }
            catch
            {
            #if DEBUG
                throw;
            #else
                iErrorNumber = Errors.Unknown;
            #endif
            }

            #if DEBUG
            if ( iErrorNumber == Errors.None || iErrorNumber == Errors.UploadedFileRenamed || iErrorNumber == Errors.UploadedInvalidNameRenamed )
                response.Clear();
            #else
            response.Clear();
            #endif
            System.Web.HttpRequest _Request = System.Web.HttpContext.Current.Request;
            // CKFinder 2.x flash component
            if ( _Request.QueryString["response_type"] != null && "txt" == _Request.QueryString["response_type"].ToString() )
            {
                string _errorMsg = "";
                if ( iErrorNumber > 0 )
                {
                    _errorMsg = Lang.getErrorMessage( iErrorNumber ).Replace( "%1", sFileName );
                    if ( iErrorNumber != Errors.UploadedFileRenamed && iErrorNumber != Errors.UploadedInvalidNameRenamed )
                        sFileName = "";
                }
                response.Write( sFileName + "|" + _errorMsg );
            }
            // CKEditor 4.5.0+
            else if ( _Request.QueryString["responseType"] != null && "json" == _Request.QueryString["responseType"].ToString() )
            {
                // Cleans the response buffer.
                response.ClearHeaders();
                response.Clear();

                // Prevent the browser from caching the result.
                response.CacheControl = "no-cache";

                // Set the response format.
                response.ContentEncoding = System.Text.UTF8Encoding.UTF8;
                response.ContentType = "application/json";

                string _errorMsg = "";
                string fileUrl = this.CurrentFolder.Url + CKFinder.Connector.Util.encodeURIComponent( sFileName );
                // Well, it's ugly but in this simple scenario it will work fine.
                string jsonTemplate = @"""fileName"":""{0}"",""uploaded"":{1}";
                string jsonUrlTemplate = @",""url"":""{0}""";
                string jsonErrorTemplate = @",""error"":{{""number"":{0},""message"":""{1}""}}";
                string jsonResponse;
                bool uploaded;

                if ( iErrorNumber > 0 )
                {
                    _errorMsg = Lang.getErrorMessage( iErrorNumber ).Replace( "%1", sFileName );
                }

                switch ( iErrorNumber )
                {
                    case Errors.None:
                    case Errors.UploadedFileRenamed:
                    case Errors.UploadedInvalidNameRenamed:
                        uploaded = true;
                        break;
                    default:
                        uploaded = false;
                        break;
                }

                jsonResponse = "{" + String.Format( jsonTemplate, this.jsonEscape( sFileName ), uploaded ? "1" : "0" );
                if ( uploaded )
                {
                    jsonResponse += String.Format( jsonUrlTemplate, this.jsonEscape( fileUrl ) );
                }
                if ( iErrorNumber != Errors.None )
                {
                    jsonResponse += String.Format( jsonErrorTemplate, iErrorNumber.ToString(), this.jsonEscape( _errorMsg ) );
                }
                jsonResponse += "}";

                response.Write( jsonResponse );
            }
            // Other
            else
            {
                response.Write("<script type=\"text/javascript\">");
                response.Write( this.GetJavaScriptCode( iErrorNumber, sFileName, this.CurrentFolder.Url ) );
                response.Write( "</script>" );
            }

            Connector.CKFinderEvent.ActivateEvent( CKFinderEvent.Hooks.AfterFileUpload, this.CurrentFolder, sFilePath );

            response.End();
        }
コード例 #17
0
ファイル: Export.cs プロジェクト: hacikaraa/Goldepus
 public static void ExportToExcel(System.Web.HttpResponse response, DataTable exportData, string exportName)
 {
     string attachment = "attachment; filename=" + exportName + ".xls";
     response.ClearContent();
     response.AddHeader("content-disposition", attachment);
     response.ContentType = "application/vnd.ms-excel";
     response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1254");
     response.Charset = "windows-1254";
     string tab = "";
     foreach (DataColumn dc in exportData.Columns)
     {
         response.Write(tab + dc.ColumnName);
         tab = "\t";
     }
     response.Write("\n");
     foreach (DataRow dr in exportData.Rows)
     {
         tab = "";
         for (int i = 0; i < exportData.Columns.Count; i++)
         {
             response.Write(tab + (string.IsNullOrEmpty(dr[i].ToString()) ? "-" : dr[i].ToString().Replace("\t", "").Replace("\r", "").Replace("\n", "")));
             tab = "\t";
         }
         response.Write("\n");
     }
     response.End();
 }
コード例 #18
0
        public void FinishExport(System.Web.HttpResponse response)
        {
            Writer.Flush();

            // Need to call Response.End() so nothing will be attached to a file
            // System.Web.HttpResponse.End() function will throw System.Threading.ThreadAbortException
            // indicating that the current response ends prematurely - that's what we want
            response.End();
        }
コード例 #19
0
ファイル: ExportXls.cs プロジェクト: unie/TestGitF
        public void ExportImg2Xls(System.Web.HttpResponse Response, byte[] imgBytes, string filename,int imgHeight,int imgWidth)
        {
            //byte[] bytes = System.IO.File.ReadAllBytes(@"E:\mineown\mine\TrainerEvaluate20140929\untitled.png");
            hssfworkbook=new HSSFWorkbook();
              //  File.WriteAllBytes(@"d:\11.png",imgBytes);
            int pictureIdx = hssfworkbook.AddPicture(imgBytes, PictureType.PNG);
            //create sheet
            var sheet = hssfworkbook.CreateSheet("课程满意度分布");
            // Create the drawing patriarch.  This is the top level container for all shapes.
            var patriarch = sheet.CreateDrawingPatriarch();
            //add a picture
            var anchor = new HSSFClientAnchor(0, 0,1023, 255, 0, 0,10, 18);
            var pict = patriarch.CreatePicture(anchor, pictureIdx);
            pict.Resize(1);

            Response.Clear();
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls",  HttpUtility.UrlPathEncode(filename)));
            MemoryStream file = new MemoryStream();
            hssfworkbook.Write(file);
            file.WriteTo(Response.OutputStream);
            Response.End();
        }
コード例 #20
0
ファイル: ExcelXml.cs プロジェクト: DougThompson/ExcelXml
        public string Generate(System.Web.HttpResponse response, string FileName, bool OpenInBrowser)
        {
            StringBuilder sb = new StringBuilder();

            sb = GetHeader(sb);
            sb = GetDocumentProperties(sb);
            sb = GetExcelWorkbook(sb);
            sb = GetStyles(sb);
            sb = GetNames(sb);
            sb = GetWorksheets(sb);
            sb.Append("</Workbook>");

            response.Buffer = false;
            response.Clear();
            response.ContentType = "application/vnd.ms-excel";
            if (!OpenInBrowser)
                response.AddHeader("Content-Disposition", "attachment; filename=" + FileName);
            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            response.OutputStream.Write(encoding.GetBytes(sb.ToString()), 0, encoding.GetBytes(sb.ToString()).Length);
            response.Flush();
            response.End();

            return sb.ToString();
        }
コード例 #21
0
        public override void SendResponse( System.Web.HttpResponse response )
        {
            int iErrorNumber = 0;
            string sFileName = "";
            string sFilePath = "";
            string sUnsafeFileName = "";

            try
            {
                this.CheckConnector();
                this.CheckRequest();

                if ( !this.CurrentFolder.CheckAcl( AccessControlRules.FileUpload ) )
                {
                    ConnectorException.Throw( Errors.Unauthorized );
                }

                HttpPostedFile oFile = null;
                if ( HttpContext.Current.Request.Files["upload"] != null )
                {
                    oFile = HttpContext.Current.Request.Files["upload"];
                }
                else if ( HttpContext.Current.Request.Files["NewFile"] != null )
                {
                    oFile = HttpContext.Current.Request.Files["NewFile"];
                }
                else if ( HttpContext.Current.Request.Files.AllKeys.Length > 0 )
                {
                    oFile = HttpContext.Current.Request.Files[HttpContext.Current.Request.Files.AllKeys[0]];
                }

                if ( oFile != null )
                {
                    int iPathIndex = oFile.FileName.LastIndexOf( "\\" );
                    sFileName = ( iPathIndex >= 0  && oFile.FileName.Length > 1 ) ? oFile.FileName.Substring( iPathIndex + 1 ) : oFile.FileName;

                    if ( Config.Current.CheckDoubleExtension )
                        sFileName = this.CurrentFolder.ResourceTypeInfo.ReplaceInvalidDoubleExtensions( sFileName );

                    sUnsafeFileName = sFileName;

                    if ( Config.Current.DisallowUnsafeCharacters )
                        sFileName = sFileName.Replace(";","_");

                    // Replace dots in the name with underscores (only one dot can be there... security issue).
                    if ( Config.Current.ForceSingleExtension )
                        sFileName = Regex.Replace( sFileName, @"\.(?![^.]*$)", "_", RegexOptions.None );

                    if ( sFileName != sUnsafeFileName )
                        iErrorNumber = Errors.UploadedInvalidNameRenamed;

                    if ( Connector.CheckFileName( sFileName ) && !Config.Current.CheckIsHiddenFile( sFileName ) )
                    {
                        if ( !Config.Current.CheckSizeAfterScaling && this.CurrentFolder.ResourceTypeInfo.MaxSize > 0 && oFile.ContentLength > this.CurrentFolder.ResourceTypeInfo.MaxSize )
                            ConnectorException.Throw( Errors.UploadedTooBig );

                        string sExtension = System.IO.Path.GetExtension( sFileName );
                        sExtension = sExtension.TrimStart( '.' );

                        if ( !this.CurrentFolder.ResourceTypeInfo.CheckExtension( sExtension ) )
                            ConnectorException.Throw( Errors.InvalidExtension );

                        if ( Config.Current.CheckIsNonHtmlExtension( sExtension ) && !this.CheckNonHtmlFile( oFile ) )
                            ConnectorException.Throw( Errors.UploadedWrongHtmlFile );

                        // Map the virtual path to the local server path.
                        string sServerDir = this.CurrentFolder.ServerPath;

                        string sFileNameNoExt = CKFinder.Connector.Util.GetFileNameWithoutExtension( sFileName );
                        string sFullExtension = CKFinder.Connector.Util.GetExtension( sFileName );
                        int iCounter = 0;

                        // System.IO.File.Exists in C# does not return true for protcted files
                        if ( Regex.IsMatch( sFileNameNoExt, @"^(AUX|COM\d|CLOCK\$|CON|NUL|PRN|LPT\d)$", RegexOptions.IgnoreCase ) )
                        {
                            iCounter++;
                            sFileName = sFileNameNoExt + "(" + iCounter + ")" + sFullExtension;
                            iErrorNumber = Errors.UploadedFileRenamed;
                        }

                        while ( true )
                        {
                            sFilePath = System.IO.Path.Combine( sServerDir, sFileName );

                            if ( System.IO.File.Exists( sFilePath ) )
                            {
                                iCounter++;
                                sFileName = sFileNameNoExt + "(" + iCounter + ")" + sFullExtension;
                                iErrorNumber = Errors.UploadedFileRenamed;
                            }
                            else
                            {
                                oFile.SaveAs( sFilePath );

                                if ( Config.Current.SecureImageUploads && ImageTools.IsImageExtension( sExtension ) && !ImageTools.ValidateImage( sFilePath ) )
                                {
                                    System.IO.File.Delete( sFilePath );
                                    ConnectorException.Throw( Errors.UploadedCorrupt );
                                }

                                Settings.Images imagesSettings = Config.Current.Images;

                                if ( imagesSettings.MaxHeight > 0 && imagesSettings.MaxWidth > 0 )
                                {
                                    ImageTools.ResizeImage( sFilePath, sFilePath, imagesSettings.MaxWidth, imagesSettings.MaxHeight, true, imagesSettings.Quality );

                                    if ( Config.Current.CheckSizeAfterScaling && this.CurrentFolder.ResourceTypeInfo.MaxSize > 0 )
                                    {
                                        long fileSize = new System.IO.FileInfo( sFilePath ).Length;
                                        if ( fileSize > this.CurrentFolder.ResourceTypeInfo.MaxSize )
                                        {
                                            System.IO.File.Delete( sFilePath );
                                            ConnectorException.Throw( Errors.UploadedTooBig );
                                        }
                                    }
                                }

                                break;
                            }
                        }
                    }
                    else
                        ConnectorException.Throw( Errors.InvalidName );
                }
                else
                    ConnectorException.Throw( Errors.UploadedCorrupt );
            }
            catch ( ConnectorException connectorException )
            {
                iErrorNumber = connectorException.Number;
            }
            catch ( System.Security.SecurityException )
            {
            #if DEBUG
                throw;
            #else
                iErrorNumber = Errors.AccessDenied;
            #endif
            }
            catch ( System.UnauthorizedAccessException )
            {
            #if DEBUG
                throw;
            #else
                iErrorNumber = Errors.AccessDenied;
            #endif
            }
            catch
            {
            #if DEBUG
                throw;
            #else
                iErrorNumber = Errors.Unknown;
            #endif
            }

            #if DEBUG
            if ( iErrorNumber == Errors.None || iErrorNumber == Errors.UploadedFileRenamed || iErrorNumber == Errors.UploadedInvalidNameRenamed )
                response.Clear();
            #else
            response.Clear();
            #endif
            System.Web.HttpRequest _Request = System.Web.HttpContext.Current.Request;
            if ( _Request.QueryString["response_type"] != null && "txt" == _Request.QueryString["response_type"].ToString() )
            {
                string _errorMsg = "";
                if ( iErrorNumber > 0 )
                {
                    _errorMsg = Lang.getErrorMessage( iErrorNumber ).Replace( "%1", sFileName );
                    if ( iErrorNumber != Errors.UploadedFileRenamed && iErrorNumber != Errors.UploadedInvalidNameRenamed )
                        sFileName = "";
                }
                response.Write( sFileName + "|" + _errorMsg );
            }
            else
            {
                response.Write("<script type=\"text/javascript\">");
                response.Write( this.GetJavaScriptCode( iErrorNumber, sFileName, this.CurrentFolder.Url ) );
                response.Write( "</script>" );
            }

            Connector.CKFinderEvent.ActivateEvent( CKFinderEvent.Hooks.AfterFileUpload, this.CurrentFolder, sFilePath );

            response.End();
        }
コード例 #22
0
 public static void Convert(System.Data.DataSet ds, string TableName, System.Web.HttpResponse response, string ExcelName)
 {
     //let's make sure the table name exists
     //if it does not then call the default method
     if (ds.Tables[TableName] == null)
     {
         Convert(ds, response, ExcelName);
     }
     //we've got a good table so
     //let's clean up the response.object
     response.Clear();
     response.Charset = "";
     //set the response mime type for excel
     response.ContentType = "application/vnd.ms-excel";
     //create a string writer
     System.IO.StringWriter stringWrite = new System.IO.StringWriter();
     //create an htmltextwriter which uses the stringwriter
     System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
     //instantiate a datagrid
     System.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid();
     //set the datagrid datasource to the dataset passed in
     dg.DataSource = ds.Tables[TableName];
     //bind the datagrid
     dg.DataBind();
     //tell the datagrid to render itself to our htmltextwriter
     dg.RenderControl(htmlWrite);
     //all that's left is to output the html
     response.Write(stringWrite.ToString());
     response.End();
 }
コード例 #23
0
ファイル: ExportXls.cs プロジェクト: unie/TestGitF
        public void ExportToXls(System.Web.HttpResponse Response, List<string> fieldsName, DataTable exportDs, string filename)
        {
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", System.Web.HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8)));
            Response.Clear();

            InitializeWorkbook();
            GenerateData(fieldsName, exportDs, filename);
            GetExcelStream().WriteTo(Response.OutputStream);
            Response.End();
        }
コード例 #24
0
ファイル: SiteService.cs プロジェクト: foster-hub/box-cms
        public void ResponseFile(System.Web.HttpResponse response, string fileUId)
        {
            Box.CMS.File file = cms.GetFile(fileUId);
            if (file == null)
                response.End();

            response.ContentType = file.Type;
            response.BinaryWrite(file.Data.StoredData);
            response.End();
        }
コード例 #25
0
ファイル: PH_Utility.cs プロジェクト: parnupongk/primary
        /// <summary>
        /// Export DataGrid To Excel
        /// </summary>
        /// <param name="response">ส่ง Response</param>
        /// <param name="thisPage">ส่ง this</param>
        /// <param name="objDataGrid">ส่ง DataGrid ที่ต้องการ Export</param>
        /// <param name="header">ชื่อ Header</param>
        /// <param name="footer">ชื่อ Footer</param>
        public void ExportToExcel(System.Web.HttpResponse response, System.Web.UI.Page thisPage, GridView objDataGrid, string header, string footer)
        {
            response.Clear();
                response.Buffer = true;
                response.ContentType = "application/vnd.ms-excel";
                response.ContentEncoding = System.Text.Encoding.UTF8;
                response.Charset = "";
                //Response.AddHeader("Content-Disposition", "attachment;filename=Clientes.xls");

                string open = @"<html xmlns:x=""urn:schemas-microsoft-com:office:excel""><head><style>
            <!--table
            br {mso-data-placement:same-cell;}
            tr {vertical-align:middle;}
            td {mso-number-format:\@;font-family:Tahoma, sans-serif;font-size:8.0pt;text-align:center;}
            --></style></head> <body>";

                response.Write(open);

                thisPage.EnableViewState = false;
                if (header != "")
                {
                    response.Write("<font face='Tahoma'><b>" + header + "</b></font>");
                }
                System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);

                this.ClearControl(objDataGrid);

                for (int rowPos = 0; rowPos < objDataGrid.Rows.Count; ++rowPos)
                {
                    for (int colPos = 0; colPos < objDataGrid.Rows[rowPos].Cells.Count; ++colPos)
                    {
                        objDataGrid.Rows[rowPos].Cells[colPos].Attributes.Add("class", "NumberString");
                    }
                }
                objDataGrid.RenderControl(oHtmlTextWriter);

                string styleInfo = @"<style>.NumberString    {mso-number-format:\@;}</style>";
                response.Write(styleInfo + oStringWriter.ToString());
                response.Write(footer);
                response.Write("</body></html>");
                response.End();
        }
コード例 #26
0
ファイル: PH_Utility.cs プロジェクト: parnupongk/primary
 /// <summary>
 /// Export DataGrid To Excel
 /// </summary>
 /// <param name="response">ส่ง Response</param>
 /// <param name="thisPage">ส่ง this มาเลย</param>
 /// <param name="objDataGrid">ส่ง DataGrid ที่ต้องการ Export</param>
 public void ExportToExcel(System.Web.HttpResponse response, System.Web.UI.Page thisPage, GridView objDataGrid)
 {
     response.Clear();
         response.Buffer = false;
         response.ContentType = "application/vnd.ms-excel";
         response.ContentEncoding = System.Text.Encoding.UTF8;
         response.Charset = "";
         thisPage.EnableViewState = false;
         System.IO.StringWriter strWrite = new System.IO.StringWriter();
         System.Web.UI.HtmlTextWriter hWrite = new HtmlTextWriter(strWrite);
         ClearControl(objDataGrid);
         objDataGrid.RenderControl(hWrite);
         response.Write(strWrite.ToString());
         response.End();
 }
コード例 #27
0
    public void TestRenderSkybox() {
      MockedGraphicsDeviceService mockGraphicsDeviceService =
        new MockedGraphicsDeviceService(DeviceType.Reference);

      using(IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
        using(
          BasicEffect effect = new BasicEffect(
#if XNA_4
            mockGraphicsDeviceService.GraphicsDevice
#else
            mockGraphicsDeviceService.GraphicsDevice, new EffectPool()
#endif
          )
        ) {
          using(
            SkyboxCube skyboxCube = new SkyboxCube(
              mockGraphicsDeviceService.GraphicsDevice
            )
          ) {
            skyboxCube.AssignVertexBuffer();
#if XNA_4
            EffectTechnique technique = effect.CurrentTechnique;
            for(int pass = 0; pass < technique.Passes.Count; ++pass) {
              technique.Passes[pass].Apply();

              skyboxCube.DrawNorthernFace();
              skyboxCube.DrawEasternFace();
              skyboxCube.DrawSouthernFace();
              skyboxCube.DrawWesternFace();
              skyboxCube.DrawUpperFace();
              skyboxCube.DrawLowerFace();
            }
#else
            effect.Begin();
            try {
              EffectTechnique technique = effect.CurrentTechnique;
              for(int pass = 0; pass < technique.Passes.Count; ++pass) {
                technique.Passes[pass].Begin();
                try {
                  skyboxCube.DrawNorthernFace();
                  skyboxCube.DrawEasternFace();
                  skyboxCube.DrawSouthernFace();
                  skyboxCube.DrawWesternFace();
                  skyboxCube.DrawUpperFace();
                  skyboxCube.DrawLowerFace();
                }
                finally {
                  technique.Passes[pass].End();
                }
              }
            }
            finally {
              effect.End();
            }
#endif
          }
        }
      }
    }
コード例 #28
0
        public override void SendResponse( System.Web.HttpResponse response )
        {
            int iErrorNumber = 0;
            string sFileName = "";
            string sFilePath = "";
            string sUnsafeFileName = "";

            try
            {
                this.CheckConnector();
                this.CheckRequest();

                if ( !this.CurrentFolder.CheckAcl( AccessControlRules.FileUpload ) )
                {
                    ConnectorException.Throw( Errors.Unauthorized );
                }

                HttpPostedFile oFile = HttpContext.Current.Request.Files[HttpContext.Current.Request.Files.AllKeys[0]];

                if ( oFile != null )
                {
                    sUnsafeFileName = System.IO.Path.GetFileName(oFile.FileName);
                    sFileName = Regex.Replace( sUnsafeFileName, @"[\:\*\?\|\/]", "_", RegexOptions.None );
                    if ( sFileName != sUnsafeFileName )
                        iErrorNumber = Errors.UploadedInvalidNameRenamed ;

                    if ( Connector.CheckFileName( sFileName ) && !Config.Current.CheckIsHiddenFile( sFileName ) )
                    {
                        // Replace dots in the name with underscores (only one dot can be there... security issue).
                        if ( Config.Current.ForceSingleExtension )
                            sFileName = Regex.Replace( sFileName, @"\.(?![^.]*$)", "_", RegexOptions.None );

                        if ( !Config.Current.CheckSizeAfterScaling && this.CurrentFolder.ResourceTypeInfo.MaxSize > 0 && oFile.ContentLength > this.CurrentFolder.ResourceTypeInfo.MaxSize )
                            ConnectorException.Throw( Errors.UploadedTooBig );

                        string sExtension = System.IO.Path.GetExtension( oFile.FileName );
                        sExtension = sExtension.TrimStart( '.' );

                        if ( !this.CurrentFolder.ResourceTypeInfo.CheckExtension( sExtension ) )
                            ConnectorException.Throw( Errors.InvalidExtension );

                        if ( Config.Current.CheckIsNonHtmlExtension( sExtension ) && !this.CheckNonHtmlFile( oFile ) )
                            ConnectorException.Throw( Errors.UploadedWrongHtmlFile );

                        // Map the virtual path to the local server path.
                        string sServerDir = this.CurrentFolder.ServerPath;

                        string sFileNameNoExt = System.IO.Path.GetFileNameWithoutExtension( sFileName );

                        int iCounter = 0;

                        while ( true )
                        {
                            sFilePath = System.IO.Path.Combine( sServerDir, sFileName );

                            if ( System.IO.File.Exists( sFilePath ) )
                            {
                                iCounter++;
                                sFileName =
                                    sFileNameNoExt +
                                    "(" + iCounter + ")" +
                                    System.IO.Path.GetExtension( oFile.FileName );

                                iErrorNumber = Errors.UploadedFileRenamed;
                            }
                            else
                            {
                                oFile.SaveAs( sFilePath );

                                if ( Config.Current.SecureImageUploads && ImageTools.IsImageExtension( sExtension ) && !ImageTools.ValidateImage( sFilePath ) )
                                {
                                    System.IO.File.Delete( sFilePath );
                                    ConnectorException.Throw( Errors.UploadedCorrupt );
                                }

                                Settings.Images imagesSettings = Config.Current.Images;

                                if ( imagesSettings.MaxHeight > 0 && imagesSettings.MaxWidth > 0 )
                                {
                                    ImageTools.ResizeImage( sFilePath, sFilePath, imagesSettings.MaxWidth, imagesSettings.MaxHeight, true, imagesSettings.Quality );

                                    if ( Config.Current.CheckSizeAfterScaling && this.CurrentFolder.ResourceTypeInfo.MaxSize > 0 )
                                    {
                                        long fileSize = new System.IO.FileInfo( sFilePath ).Length;
                                        if ( fileSize > this.CurrentFolder.ResourceTypeInfo.MaxSize )
                                        {
                                            System.IO.File.Delete( sFilePath );
                                            ConnectorException.Throw( Errors.UploadedTooBig );
                                        }
                                    }
                                }

                                break;
                            }
                        }
                    }
                    else
                        ConnectorException.Throw( Errors.InvalidName );
                }
                else
                    ConnectorException.Throw( Errors.UploadedCorrupt );
            }
            catch ( ConnectorException connectorException )
            {
                iErrorNumber = connectorException.Number;
            }
            catch ( System.Security.SecurityException )
            {
            #if DEBUG
                throw;
            #else
                iErrorNumber = Errors.AccessDenied;
            #endif
            }
            catch ( System.UnauthorizedAccessException )
            {
            #if DEBUG
                throw;
            #else
                iErrorNumber = Errors.AccessDenied;
            #endif
            }
            catch
            {
            #if DEBUG
                throw;
            #else
                iErrorNumber = Errors.Unknown;
            #endif
            }

            #if DEBUG
            if ( iErrorNumber == Errors.None || iErrorNumber == Errors.UploadedFileRenamed || iErrorNumber == Errors.UploadedInvalidNameRenamed )
                response.Clear();
            #else
            response.Clear();
            #endif
            response.Write( "<script type=\"text/javascript\">" );
            response.Write( this.GetJavaScriptCode( iErrorNumber, sFileName, this.CurrentFolder.Url + sFileName ) );
            response.Write( "</script>" );

            Connector.CKFinderEvent.ActivateEvent( CKFinderEvent.Hooks.AfterFileUpload, this.CurrentFolder, sFilePath );

            response.End();
        }
コード例 #29
0
ファイル: Utilerias.cs プロジェクト: JavierTMC/ASP.NET
 public static void ExportToExcel(System.Web.HttpResponse Response, string datos)
 {
     Response.Clear();
     Response.Write(datos);
     Response.ContentType = "application/vnd.ms-excel";
     Response.AppendHeader("Content-Disposition", "attachment; filename=Informe.xls");
     Response.End();
 }