asp.net 生成静态页面
后台:
string strDate = DateTime.Now.ToString("yyMMdd") + "\\" + DateTime.Now.ToString("yyyyMMddHHmmss");
string strFileName = strDate + ".html";
string strTitle = this.Txt_C_Name.Text.Trim();
string strContent = this.Content.Value.Trim();
string[] content = strContent.Split(new Char[] { '^' });//对内容进行拆分,并保存到数组【^】
int upbound = content.Length;//数组的上限
//SqlServerDataBase db = new SqlServerDataBase();
//bool success = db.Insert("insert into inNews(Title,Content,FilePath)values('" + strTitle + "','" + strContent + "','" + strFileName + "')", null);
//if (success)
// Message.Text = "添加成功!";
/**/
///////////////////////////创建当前日期的文件夹开始
string dir = Server.MapPath("../Files/" + DateTime.Now.ToString("yyMMdd"));//用来生成文件夹
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
/**/
///////////////////////////创建当前日期的文件夹结束
try
{
for (int i = 0; i < content.Length; i++)
{
//string[] newContent = new string[4];//定义和html标记数目一致的数组
StringBuilder strhtml = new StringBuilder();
//创建StreamReader对象
using (StreamReader sr = new StreamReader(Server.MapPath("Template/") + "\\template.html", Encoding.GetEncoding("gb2312")))
{
String oneline;
//读取指定的HTML文件模板
while ((oneline = sr.ReadLine()) != null)
{
strhtml.Append(oneline);
}
sr.Close();
}
//为标记数组赋值
//SqlServerDataBase db = new SqlServerDataBase();
//DataSet ds = db.Select("select top 1 NewsId from inNews order by NewsId desc"
相关文档:
在Web编程过程中,存在着很多安全隐患。比如在以前的ASP版本中,Cookie为访问者和编程者都提供了方便,并没有提供加密的功能。打开IE浏览器,选择“工具”菜单里的“Internet选项”,然后在弹出的对话框里单击“设置”按钮,选择“查看文件”按钮,在弹出的窗口中,就会显示硬盘里 ......
在web.config中修改修改属性
1:<configSections><configSections>中加下面代码
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral ......
最近在和一个同学编写一个管理系统的时候,要用到GridView控件,结果在CSDN里面找到一个博客,这些讲得很详细,提供一个地址给大家参考吧
http://blog.csdn.net/21aspnet/archive/2007/03/25/1540301.aspx
还有一个就是百度空间里面的:http://hi.baidu.com/%BA%AB%C7%EC%D5%EA/blog/item/c0b717daa312fb3f33fa1c91.html ......
asp.net 1.1 的应用程序,默认是不支持firefox的
iis会根据请求的user-agent 来判断浏览器类型,如果浏览器达不到要求,返回的html会渲染有问题
比方说 多行的textbox在firefox下不会渲染出width和height,是默认大小
原因是asp.net 1.1时,firefox还不强大,没有被microsoft注意到
其实可以在web.config里配置一下,让 ......
这是一篇转载的博文,看了这篇文章,大受启发。因此,稍作修改,转载到我的空间与大家分享,供有需要的同学学习,并呼吁大家一起来学ASP.NET技术!
第一步 掌握一门.NET面向对象语言,C#或VB.NET ,在没有面向对象(OO)基础的情况下直接学ASP.NET是很痛苦的(我深有体会)。ASP.NET是一个全面向对象的技术, ......