易截截图软件、单文件、免安装、纯绿色、仅160KB

大家帮忙看看 我怎么才能把数据换成HTML格式的

C# code:
protected void Button1_Click(object sender, EventArgs e)
{
string str = HttpContext.Current.Server.MapPath("/WebSite1");
str += @"\index.htm";

TextBox1.Text=this.getUrlContent(str);//获取HTML资源

string path = HttpContext.Current.Server.MapPath("/WebSite1");
path += @"\1.htm";

if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
[color=#FF0000] sw.WriteLine(TextBox1.Text);[/color] }
}
else
{
File.Delete(path);
using (StreamWriter sw = File.CreateText(path))
{
[color=#FF0000]sw.WriteLine(TextBox1.Text);[/color]
}
}
}
private string getUrlContent(string url)
{
if (url == null || url.Trim() == "")
return null;
WebClient wc = new WebClient();
wc.Credentials = CredentialCache.DefaultCredentials;
Byte[] pageData = wc.DownloadData(url);
return System.Text.Encoding.Default.GetString(pageData);//.ASCII.GetString

}

红色部分 将文本框的内容写入 HTML文件  可写进去的有些是乱码
各位大侠 应该怎么改 能让他不是乱码 而是HMTL格式的呢
up

UP



相关问答:

java applet在html中无法显示

我的java applet 嵌入html后无法显示,而用appletviewer显示正常为什么,还有就是用html converter转化后可以显示,为什么?请大侠赐教!
HTML code:

<HTML>
<HEAD>
<TITLE>TEST.HTML< ......

javacript循环显示HTML代码

例:把下面一行代码用循环10次.后页面代码显示为10行;其中strID后跟着循环次数显示,如strID1,strID2,strID3

            <tr>
        &nbs ......

html操作

怎么在表外面套一个正方形的框
  以表格外边框为准!
HTML code:

<table id="mytable" align="center" cellspacing="0" summary="The technical specificati ......

html控件如何执行c#函数??

<input id="Button1" type="button">这样一个html控件,我想让他执行c#一个类的函数,如何做啊??
<input id="Button1" type="button" value="buton" o ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号