当前位置: 首页>>代码示例>>C#>>正文


C# HttpResponse.Write方法代码示例

本文整理汇总了C#中HttpResponse.Write方法的典型用法代码示例。如果您正苦于以下问题:C# HttpResponse.Write方法的具体用法?C# HttpResponse.Write怎么用?C# HttpResponse.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpResponse的用法示例。


在下文中一共展示了HttpResponse.Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Send412

 /// <summary>
 /// Creates and sends an HttpResponse packet for an exception, wraps it to an error 401
 /// </summary>
 private void Send412(HttpResponse response)
 {
     response.Status = "412";
     response.Write("<html><head><title>412 Precondition Failed</title></head><body>");
     response.Write("<h3>Precondition Failed (412)</h3>");
     response.Write("Unable to find a necessary cookie, please ensure that your browser supports cookies and have them enabled.");
     response.Write("</body></html>");
 }
开发者ID:mizzunet,项目名称:spike-box,代码行数:11,代码来源:HandlerElement.cs

示例2: Minify

    private static void Minify(HttpResponse response, string file, string ext)
    {
        string content = File.ReadAllText(file);
        Minifier minifier = new Minifier();

        if (ext == ".css")
        {
            CssSettings settings = new CssSettings() { CommentMode = CssComment.None };
            response.Write(minifier.MinifyStyleSheet(content, settings));
        }
        else if (ext == ".js")
        {
            CodeSettings settings = new CodeSettings() { PreserveImportantComments = false };
            response.Write(minifier.MinifyJavaScript(content, settings));
        }
    }
开发者ID:rroman81,项目名称:MiniBlog,代码行数:16,代码来源:MinifyHandler.cs

示例3: WriteJsonData

    //truyen json data len form
    public static void WriteJsonData(HttpResponse response, Object obj)
    {
        response.Clear();
        response.ClearContent();
        response.ClearHeaders();
        System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer { MaxJsonLength = Int32.MaxValue, RecursionLimit = 100 };

        string output = oSerializer.Serialize(obj);

        response.ContentType = "Application/Json";
        response.Write(output);
        response.End();
    }
开发者ID:Vinhbaba,项目名称:dskfeorfqlhvsea,代码行数:14,代码来源:Default.aspx.cs

示例4: DownloadFile

    /// <summary>
    /// �������ؿ�
    /// </summary>
    /// <param name="argResp">����ҳ��</param>
    /// <param name="argFileStream">�ļ���</param>
    /// <param name="strFileName">�ļ���</param>
    public static void DownloadFile(HttpResponse argResp, StringBuilder argFileStream, string strFileName)
    {
        try {
            string strResHeader = "attachment; filename=" + Guid.NewGuid().ToString() + ".csv";
            if (!string.IsNullOrEmpty(strFileName)) {
                strResHeader = "inline; filename=" + strFileName;
            }
            argResp.AppendHeader("Content-Disposition", strResHeader);//attachment˵���Ը������أ�inline˵�����ߴ�
            argResp.ContentType = "application/ms-excel";
            argResp.ContentEncoding = Encoding.GetEncoding("GB2312"); // Encoding.UTF8;//
            argResp.Write(argFileStream);

        } catch (Exception ex) {
            throw ex;
        }
    }
开发者ID:hijoy,项目名称:CPL_ERS,代码行数:22,代码来源:VendorManage.aspx.cs

示例5: Output

        public static void Output(HttpResponse Response)
        {
            Response.Write("<br/>HostingEnvironment.ApplicationPhysicalPath=" + System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath);
            Response.Write("<br/>HostingEnvironment.ApplicationVirtualPath=" + System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath);
            Response.Write("<br/>HostingEnvironment.SiteName=" + System.Web.Hosting.HostingEnvironment.SiteName + "\n");
            //RazorGenerator.Mvc.EngineDebug.ListRoutes(Response);

            try
            {
                var index = Microsoft.SourceBrowser.SourceIndexServer.Models.Index.Instance;

                Response.Write(String.Format("<br/>Index.RootPath={0}\n", index.RootPath));
                Response.Write(String.Format("<br/>Index.ProjPath={0}\n", index.ProjPath));
                // RoutingModule.EnumerateHttpModules(url, Response);
            }
            catch (Exception ex) { Response.Write(String.Format("Route modules error {0}", ex.Message)); }
        }
开发者ID:akrisiun,项目名称:SourceBrowser,代码行数:17,代码来源:RouteConfig.cs

示例6: sendResponseAsJson

 private void sendResponseAsJson(HttpResponse response, string responseString)
 {
     response.Clear();
     response.BufferOutput = true;
     response.StatusCode = 200; // HttpStatusCode.OK;
     response.Write(responseString);
     response.ContentType = "application/json; charset=utf-8";
     response.End();
 }
开发者ID:kum63304,项目名称:SmartHouse,代码行数:9,代码来源:ArduinoHttpHandler.cs

示例7: sendFile

 private void sendFile(HttpResponse response, string fileName)
 {
     /*
      * client.println("HTTP/1.1 200 OK");
         client.println("Content-Type: text/html");
         client.println("Connection: close");  // the connection will be closed after completion of the response
         client.println();
      */
     response.Clear();
     response.BufferOutput = true;
     response.StatusCode = 200; // HttpStatusCode.OK;
     response.Write(SD.readAllFile(fileName));
     response.ContentType = "text/html";
     response.End();
 }
开发者ID:kum63304,项目名称:SmartHouse,代码行数:15,代码来源:ArduinoHttpHandler.cs

示例8: ExportExcel

    /// <summary>
    /// Export excel with HTML format
    /// </summary>
    /// <param name="response">Current page response</param>
    /// <param name="fileName">export file name</param>
    /// <param name="tb">web html table</param>
    public static void ExportExcel(HttpResponse response, string fileName, Table tb)
    {
        try
        {
            response.Clear();
            response.ClearContent();
            response.ClearHeaders();
            response.Buffer = true;
            response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";

            response.AppendHeader("Content-Disposition", string.Format("attachment; filename={0}", fileName));

            response.Charset = "utf-8";
            response.ContentEncoding = System.Text.Encoding.UTF8;
            response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());

            System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
            tb.RenderControl(oHtmlTextWriter);
            response.Write(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">");
            response.Write(AddExcelStyling());
            string style = @"<style> .text { mso-number-format:\@; } </style>";
            response.Write(style);
            response.Write(oStringWriter.ToString());

            response.End();
        }
        catch (Exception ex)
        {
            Pollinator.Common.Logger.Error("Error occured at " + typeof(ImportExportUltility).Name + " ExportExcel().:", ex);
            response.End();
        }
    }
开发者ID:nazrulcse,项目名称:pollinatror,代码行数:39,代码来源:ImportExportUltility.cs

示例9: ExportCSV

    public static int numFieldOfImportFile = 16; //number column of import file

    #endregion Fields

    #region Methods

    /// <summary>
    /// Export data to csv and response directly
    /// </summary>
    /// <param name="response">Current page response</param>
    /// <param name="fileName">export file name</param>
    /// <param name="listData">list data to export</param>
    public static void ExportCSV(HttpResponse response, string fileName, List<ImportExportFields> listData)
    {
        //prepare the output stream
        response.Clear();
        response.Buffer = true;
        // response.ContentType = "text/csv";
        response.ContentType = "application/octet-stream";//application/vnd.ms-excel";
        response.AppendHeader("Content-Disposition", string.Format("attachment; filename={0}", fileName));
        //response.ContentEncoding = Encoding.Unicode;
        response.ContentEncoding = System.Text.Encoding.UTF8;
        response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());

        response.Write(DataToCsvString(listData));

        response.Flush();
        response.End();
    }
开发者ID:nazrulcse,项目名称:pollinatror,代码行数:29,代码来源:ImportExportUltility.cs

示例10: EnumRecursive

    static void EnumRecursive(HttpResponse response, VirtualDirectory vdir) {
        foreach (VirtualFile vfile in vdir.Files) {
            response.Write("File: " + vfile.VirtualPath + "<br>\r\n");
        }

        foreach (VirtualDirectory childVdir in vdir.Directories) {
            response.Write("Directory: " + childVdir.VirtualPath + "<br>\r\n");
            EnumRecursive(response, childVdir);
        }
    }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:MapPathBasedVirtualPathProvider.cs

示例11: LoadSimpleList

    public static void LoadSimpleList(UInt32 OwnerID, HttpResponse Response)
    {
        db = new SQLDatabaseManager();

        String query = "SELECT * FROM dbo.ANIMAL WHERE IDCLIENTE='" + OwnerID + "'";

        DataTable temp;
        temp = db.GetDataTable(query);

        if (temp.Rows.Count < 1)
            return;

        foreach (DataRow r in temp.Rows)
        {
            Response.Write("<p> &raquo; <a href='\\Animal\\Animal?AnimalID=" + r["IDANIMAL"].ToString() + "'>" + r["NOME"].ToString() + "</a></p>");
        }
    }
开发者ID:luiseduardohdbackup,项目名称:MobilVet,代码行数:17,代码来源:Animal.cs

示例12: LoadConsultas

    public static void LoadConsultas(UInt32 IDClient, HttpResponse Response)
    {
        db = new SQLDatabaseManager();

        String query = String.Format("SELECT * FROM dbo.MARCACAO WHERE IDCLIENTE='{0}' AND ESTADO<>'2'", IDClient);

        DataTable temp;

        temp = db.GetDataTable(query);

        if(temp.Rows.Count == 0)
        {
            Response.Write("Não existem consultas agendadas.");
            return;
        }
    }
开发者ID:luiseduardohdbackup,项目名称:MobilVet,代码行数:16,代码来源:Core.cs

示例13: ExportToCSV

 private void ExportToCSV(string exportContent, HttpResponse response)
 {
     response.Clear();
     response.AddHeader("content-disposition", "attachment;filename=" + fileName);
     response.Charset = "";
     response.ContentType = "application/octet-stream";
     System.IO.StringWriter stringWrite = new System.IO.StringWriter();
     System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
     response.Write(exportContent);
     response.End();
 }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:11,代码来源:ExcelManager.cs

示例14: ExportToExcel

    public static void ExportToExcel(HttpResponse response, DataSet ds)
    {
        NumberFormatInfo numInfo = Util.GetYankeeNumberFormat();
        DataTable dt = ds.Tables[0];

        response.ClearContent();
        response.ContentEncoding = System.Text.Encoding.UTF8;
        response.ContentType = "application/vnd.ms-excel";
        string tab = "";
        foreach (DataColumn dc in dt.Columns)
        {
            response.Write(tab + dc.ColumnName);
            tab = "\t";
        }
        response.Write("\n");
        int i;
        foreach (DataRow dr in dt.Rows)
        {
            tab = "";
            for (i = 0; i < dt.Columns.Count; i++)
            {
                switch (Util.GetMainTypeCode(dr[i].GetType()))
                {
                    case MainTypeCodes.Number:
                        response.Write(tab + ((decimal)dr[i]).ToString("0.00#####", numInfo));
                        break;
                    case MainTypeCodes.DateTime:
                        response.Write(tab + ((DateTime)dr[i]).ToString("yyyy-MM-dd"));
                        break;
                    default:
                        response.Write(tab + dr[i].ToString());
                        break;
                }
                tab = "\t";
            }
            response.Write("\n");
        }
        response.End();
    }
开发者ID:kiquenet,项目名称:B4F,代码行数:39,代码来源:Utility.cs

示例15: LoadPayments

    public static void LoadPayments(WebsiteUser Obj, HttpResponse Response)
    {
        String query = String.Format("SELECT * FROM dbo.PAGAMENTO WHERE IDCLIENTE='{0}'", Obj.ClientID);

        DataTable temp;
        temp = db.GetDataTable(query);

        foreach(DataRow r in temp.Rows)
        {
            Response.Write("<div class='col-md-4'>");
            Response.Write("<h4><u>Data: </u> " + r["DATA_LIMITE"].ToString().Remove(11) + "</h4>");
            Response.Write("<p><a class='btn btn-default' href='\\Account\\Payments\\Payment?PaymentID=" + r["IDPAGAMENTO"].ToString() + "'>Detalhes &raquo;</a></p>");
            Response.Write("</div>");
        }
    }
开发者ID:luiseduardohdbackup,项目名称:MobilVet,代码行数:15,代码来源:Core.cs


注:本文中的HttpResponse.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。