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

ASP.NET自定义错误页面

1、添加Web.config, < system.web>< /system.web>中添加< customErrors mode="On"
defaultRedirect="ApplicationErroy.aspx" >< /customErrors>节点,
2、添加Global.asax文件,找到Application_Error事件,加入以下代码:   
//这是添加了一个全局应用程序类 在Application_Error事件中处理错误页面 和web.config没有关系 即使没有web.config 也是可以定位到错误页面
    void Application_Error(object sender, EventArgs e)
    {
        //在出现未处理的错误时运行的代码
        Exception erroy = Server.GetLastError();    
         string err = "出错页面是:" + Request.Url.ToString() + "</br>";    
         err += "异常信息:" + erroy.Message + "</br>";   
         err += "Source:" + erroy.Source + "</br>";    
         err += "StackTrace:" + erroy.StackTrace + "</br>";    
        //清除前一个异常
        Server.ClearError();
         //此处理用Session["ProError"]出错。所以用 Application["ProError"]
         Application["erroy"] = err;
         //此处不是page中,不能用Response.Redirect("../frmSysError.aspx");
        
System.Web.HttpContext.Current.Response.Redirect(HttpContext.Current.Request.ApplicationPath
+ "/ApplicationErroy.aspx");
}
2、添加错误处理页面:ApplicationErroy.aspx


相关文档:

浅谈ASP.net安全编程

在Web编程过程中,存在着很多安全隐患。比如在以前的ASP版本中,Cookie为访问者和编程者都提供了方便,并没有提供加密的功能。打开IE浏览器,选择“工具”菜单里的“Internet选项”,然后在弹出的对话框里单击“设置”按钮,选择“查看文件”按钮,在弹出的窗口中,就会显示硬盘里 ......

ASP.NET的五大数据控件浅谈(转)

CheckBox选择组件是一个程序中都经常的组件。在程序设计中使用到该组件,一般都不会只使用到一个,往往是以多个此类组件的形式出现的。在ASP.NET页面中如果要使用到多个CheckBox组件,除了添加多个CheckBox组件在页面中之外,还有一种比较方便的方法,就是使用CheckBoxList 组件。CheckBoxList组件是由一组的CheckBox组件组 ......

ASP.NET 2.0中使用Membership

转载
:LoveCherry
技术无极限
摘要:
本文介绍了怎么在
ASP.NET 2.0
中使用
Membership
新特性,并且介绍了怎么两种不同的
Membership

Provider

ActiveDirectoryMembershipProvider

SqlMembershipProvider
,前者是基于微软活动目录服务存储用户信息的,或者是基于
SQL SERVER
存储的。
2.0
......

asp.net 数据库操作类

using System;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
namespace op_db
{
/**//// <summary>
/// 专门用来处理与数据库的操作
/// </summary>
    public class&n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号