ASP.NET MVC及IIS6.0配置总结
1. config结构
Framework\Config\Machine.config, 为所有config的根,特别只有它才能具有<processMode>节,该节修改后必须重启IIS方能生效,而其它节的改动,只要一保存,就有效了,这是IIS6的一大进步。
以下分别是从上往下的几个家族类(为继承关系,这种设计可以大量减少重复代码)
Frameework\Config\Web.config
网站的Web.config
虚拟目录的Web.config
各级子目录的Web.config
<location path='some path' />可以直接访问这个家族树上的任意一个Web.config
2.常用section和sectionGroup, 可参见msdn
<system.Web>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules> 就是来定义MVC, 其实这种设计,已经有AOP的思想了
3.自定义配置
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
相关文档:
(1)asp.net 实现n秒后页面自动跳转
1.
<script type="text/javascript" language="javascript">
function reloadyemian()
{
window.location.href = "javascript:history.go(-1)";
}
window.setTimeout("reloadyemian();",5000);
</script> ......
asp.net(C#)实现SQL2000数据库备份和还原
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.Htm ......
Bitmap srcImg = new Bitmap(300, 300); //也可以读入一张图片
Graphics graphics = Graphics.fromImage(srcImg);
Font font = new Font("宋体", 16); //字体与大小
Brush brush = new SolidBrush(Color.Red);
graphics.DrawString("www.cftea.com", font, brush, 50, 50); //写字,最后两个参数表示位置
Pen pen = ne ......
#region 1
private void CreateCheckCodeImage()
{
//获取随即字符串
int number;
char code;
string checkCode = String.Empty;
System.Random random1 = new Random();
for (int i = 0; i < 5; i++)
{
number = random1.Next( ......
asp.net中导出有很多方法。其中比较推荐的兼容导出是导出为word/excel兼容的mhtml格式并设置流格式为word或excel。
这中方法的好处是可以建立一个通用的库。本文中提出了一个通用的导出类,实践中使用效果较好。(ps,html解析类写的比较仓促,各位如有兴趣可重写一下~)
///
///@Author Simsure
///@Version 1.0
///
......