麻烦问一下,如何使用C#调用本地文件夹内的HTML文件,我用的是VS2005拖了一个WEB控件.填写URL地址不行呀
麻烦问一下,如何使用C#调用本地文件夹内的HTML文件,我用的是VS2005拖了一个WEB控件.填写URL地址不行呀好像是只能调用远程的URL不能调用本地的,请各位达人给...
麻烦问一下,如何使用C#调用本地文件夹内的HTML文件,我用的是VS2005拖了一个WEB控件.填写URL地址不行呀好像是只能调用远程的URL不能调用本地的,请各位达人给个例子,谢谢!
展开
展开全部
下面是我自己用vs2008做的程序,希望对你有帮助。
string content = string.Empty;
String real_filename = System.IO.Path.GetFileName(this.UploadContent.PostedFile.FileName);
String save_folder = DateTime.Today.Year.ToString();
DirectoryInfo di = new DirectoryInfo(Server.MapPath(".") + "\\UpLoadFile\\" + save_folder);
if (!di.Exists) di.Create();
string upload_namepath = di.ToString() + "\\" + real_filename;
//保存文件
this.UploadContent.PostedFile.SaveAs(upload_namepath);
StreamReader sread = new StreamReader(upload_namepath, Encoding.GetEncoding("GB2312"));
content = HttpUtility.HtmlEncode(sread.ReadToEnd());
fckImageContent.Value = HttpUtility.HtmlDecode(content);
this.hfMailContent.Value = content;
string content = string.Empty;
String real_filename = System.IO.Path.GetFileName(this.UploadContent.PostedFile.FileName);
String save_folder = DateTime.Today.Year.ToString();
DirectoryInfo di = new DirectoryInfo(Server.MapPath(".") + "\\UpLoadFile\\" + save_folder);
if (!di.Exists) di.Create();
string upload_namepath = di.ToString() + "\\" + real_filename;
//保存文件
this.UploadContent.PostedFile.SaveAs(upload_namepath);
StreamReader sread = new StreamReader(upload_namepath, Encoding.GetEncoding("GB2312"));
content = HttpUtility.HtmlEncode(sread.ReadToEnd());
fckImageContent.Value = HttpUtility.HtmlDecode(content);
this.hfMailContent.Value = content;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询