<%@ Page Language="C#" %> <%@ Import Namespace="System.IO" %> <html> <head> <script runat="server"> void Page_Load(object sender, EventArgs e) { string arg = (string) Request.QueryString["arg"]; if (!IsPostBack && arg != null) { StringBuilder sb = new StringBuilder(); try { string file = Server.MapPath(arg); StreamReader reader = new StreamReader(file, System.Text.Encoding.GetEncoding("shift-jis")); string line; while ((line = reader.ReadLine()) != null) { sb.Append(line.Replace("\t", " ")); sb.Append("\n"); } reader.Close(); } catch (Exception ex) { sb = new StringBuilder(ex.ToString()); } output.InnerHtml = "<pre>" + Server.HtmlEncode(sb.ToString()) + "</pre>"; } } </script> </head> <body> <div id="output" runat="server" /> </body> </html>