SGGL_SHJ/SGGL/FineUIPro.Web/common/source_file.aspx.cs

28 lines
793 B
C#
Raw Permalink Normal View History

2022-09-05 16:36:31 +08:00
using System;
using System.IO;
using System.Web;
namespace FineUIPro.Web
{
public partial class source_file : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string file = Request.QueryString["file"];
if (file.StartsWith("http://") || file.StartsWith("https://"))
{
desc.Text = String.Format("<br/><br/><a href=\"{0}\" target=\"_blank\">在新窗口打开</a>", file);
return;
}
string content = File.ReadAllText(Server.MapPath(file));
desc.Text = "<pre class=\"prettyprint linenums\">" + HttpUtility.HtmlEncode(content) + "</pre>";
}
}
}
}