ASP.NET—from验证
Step 1:新建数据库(库:MyForms ;表:users ;字段:ID,userName, userPwd);
Step 2:新建网站,web.config 的文件全部代码如下:
web.config 的全部代码
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true"/>
<sessionState cookieless="AutoDetect"/>
<!--解决当浏览器端禁用Cookie时-->
<authentication mode="Forms">
<forms name="CookieName" loginUrl="login.aspx" protection="All"></forms>
<!--loginUrl为登录面URL,如果没有身份验证Cookie,客户端将被重定向到此URL-->
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<customErrors mode="On" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
</system.web>
</configuration>
Step 3:添加一个 login.aspx 页面;拖2个 TextBox ,1个Button 和1个CheckBox ;
并将CheckBox 的text 属性设为:“是否保存Cookis ";
Step 4:login.aspx 的隐藏代码如下:
login 全部隐藏代码
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI
相关文档:
因为服务器的性能有限,发现自从使用了 Castle + Nhibernate 之后,服务器在更新web站点之后的重新编译过程特别漫长,有时候都超过了1分钟,尽管发布的web程序也是编译好的。下面是web使用的动态库:
Castle.Core.dll
Castle.DynamicProxy2.dll
Castle.Facilities.AutomaticTransactionManagement.dll
Castle.Facilities ......
1、数据控件(如DataGrid/DataList等控件)格式化日期方法:
e.Item.Cell[0].Text = Convert.ToDateTime(e.Item.Cell[0].Text).ToShortDateString();
//指定列(第1列)格式化日期
2、用String类转换日期显示格式:
String.Format( "yyyy-MM-dd ",yourDateTime);
3、用Convert方法转换日期显示格式:
Convert.ToDat ......
本文将为大家简单比较ASP.NET 3.5与ASP.NET 4.0之间主要差别,希望能对大家了解ASP.NET新特性有所帮助。
ASP.NET 3.5中下列特性是之前的版本中没有的:
·Ajax集成
·LINQ
·自动属性
·Lambda表达式
同样,我希望每个人都弄清楚ASP.NET 3.5和它的下一个版本ASP.NET 4.0 ......