有一个“View.aspx”页面,在它的后台代码“View.aspx.cs”中设置任何断点都不可用。而在对应的“.ascx.cs”文件中设置断点则可以。 而且,注释掉了“View.aspx.cs”的一部分代码,但是程序照常运行,这是怎么回事?不明白,明明是“View.aspx”页面,为什么不显示断点,而且方法注释掉了也没影响。"View.aspx.cs"程序的入口在哪???代码如下:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Text;
using System.Text.RegularExpressions;namespace Forum
{
public class View : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Postnew;
protected System.Web.UI.WebControls.DataGrid dgfiList;
protected System.Web.UI.WebControls.Label PageInfo;
protected System.Web.UI.WebControls.Label PageLink;
protected System.Web.UI.WebControls.TextBox JumpTo;
protected System.Web.UI.WebControls.Button ToPage;
protected System.Web.UI.WebControls.Label Path;
protected System.Web.UI.WebControls.Label Goprev;
protected System.Web.UI.WebControls.Label Refresh;
protected System.Web.UI.WebControls.Label Gonext;
protected System.Web.UI.WebControls.Label Hitcount;
protected System.Web.UI.WebControls.Table Table1;
protected System.Web.UI.WebControls.Button SaveIt;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
protected System.Web.UI.WebControls.Label Postold;
protected System.Web.UI.WebControls.Label TopicWithMe;
public View()
{
Page.Init += new System.EventHandler(Page_Init);
} public string fbId;
public string Id;
public string cPage;
public string Title;
public DataRow[] Config;
public DataRow[] Board; private void SetModel()
{
Config=Db.Config.Table.Select("Forum_Config_Active='1'");
Id=Request.Params["Id"];
cPage="1";
if(Request.Params["Page"]!=null)
{
cPage=Request.Params["Page"];
}
fbId=Request.Params["fbId"];
if(fbId!=null && fbId!="")
{
Board=Db.Board.Table.Select("Forum_Board_Id="+Int32.Parse(fbId));
if (Board[0]["Forum_Board_Hidden"].ToString()=="1")
{
if( Session[fbId]!= null)
{
if(Session[fbId].ToString()!="1" )
{
Response.Redirect("HiddenLogin.aspx?fbId="+fbId);
}
}
else
{
Response.Redirect("HiddenLogin.aspx?fbId="+fbId);
}
}
}
string DirPath=NowPath()[0];
string DirInfo=NowPath()[1];
Title=Config[0]["Forum_Config_Name"].ToString()+"--"+DirPath+" 浏览:"+DirInfo;
}
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
SetModel();
DirPath();
SetConfig();
IsValidate();
ExeInfo();
ForumInfo();
ShowStates();
}
} private void ExeInfo()
{
Db List=new Db();
string Sql="update Forum_Info set Forum_Info_Hit=Forum_Info_Hit+1 where Forum_Info_Id="+Id;
try
{
List.ExeSql(Sql);
}
catch
{}
} private string[] NowPath()
{
string Sql;
string[] GetName=new String[2];
Db List=new Db();
Sql="select Forum_Board_Name from Forum_Board where Forum_Board_Id="+fbId;
SqlDataReader Name=List.GetList(Sql);
Name.Read();
GetName[0]=Name.GetString(0);
Name.Close();
Sql="select Forum_Info_Title,Forum_Info_Hit from Forum_Info where Forum_Info_Id="+Id;
SqlDataReader Info=List.GetList(Sql);
Info.Read();
GetName[1]=Info.GetString(0);
Hitcount.Text=(Info.GetInt32(1)+1).ToString();
Info.Close(); return GetName;
} private void DirPath()
{
string DirPath=NowPath()[0];
string DirInfo=NowPath()[1];
Db List=new Db();
Path.Text="<a href='Index.aspx'>"+Config[0]["Forum_Config_Name"]+"</a> >> <a href='List.aspx?fbId="+fbId+"'>"+DirPath+"</a> >> <a href='View.aspx?fbId="+fbId+"&Id="+Id+"'>"+List.ReplaceBadWord(DirInfo)+"</a>";
TopicWithMe.Text="<a href='MyTopic.aspx?Type=1'>我参与的话题</a> | <a href='MyTopic.aspx?Type=2'>已被回复的我的发言</a>";
string OnlineName="客人";
string OnlineClass="0";
if (Request.Cookies["UsersName"]!=null)
{
if(Request.Cookies["UsersName"].Value!="")
{
OnlineName=Request.Cookies["UsersName"].Value;
OnlineClass=Request.Cookies["UsersClass"].Value;
}
}
string Action="浏览 "+DirInfo;
List.GetOnline(DirPath,Action,Request.UserHostAddress,Request.UserAgent,OnlineName,OnlineClass);
} private void IsValidate()
{
Db List=new Db();
string Sql = "select Forum_Board_Password from Forum_Board where Forum_Board_Id='"+fbId+"'";
SqlDataReader Password = List.GetList(Sql);
Password.Read();
string pass = Password.GetString(0);
if (pass != "" && pass != null)
{
if (Request.Cookies["PassBoard"].Value = null || Request.Cookies["PassBoard"].Value = "")
{
Response.Redirect("Pass_Board.aspx?ID='" + fbId + "'&Pass='" + pass + "'");
}
else
{
if (pass != Request.Cookies["PassBoard"].Value)
{
Response.Redirect("Pass_Board.aspx?ID='" + fbId + "'&Pass='" + pass + "'");
}
}
}
} private void ForumInfo()
{
if (Int32.Parse(cPage)>=1)
{
dgfiList.CurrentPageIndex=Int32.Parse(cPage)-1;
}
else
{
dgfiList.CurrentPageIndex=0;
}
Db List=new Db();
string Sql="select * from Forum_Info inner join Forum_Users on Forum_Info.Forum_Info_Users=Forum_Users.Forum_Users_Name where Forum_Info.Isdel='0' and (Forum_Info_RootId="+Id+" or Forum_Info_Id="+Id+") order by Forum_Info_RootId ,Forum_Info_Id";
dgfiList.DataSource=List.GetGrid(Sql,"Forum_Info");
dgfiList.DataBind();
cInfo();
}
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Text;
using System.Text.RegularExpressions;namespace Forum
{
public class View : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Postnew;
protected System.Web.UI.WebControls.DataGrid dgfiList;
protected System.Web.UI.WebControls.Label PageInfo;
protected System.Web.UI.WebControls.Label PageLink;
protected System.Web.UI.WebControls.TextBox JumpTo;
protected System.Web.UI.WebControls.Button ToPage;
protected System.Web.UI.WebControls.Label Path;
protected System.Web.UI.WebControls.Label Goprev;
protected System.Web.UI.WebControls.Label Refresh;
protected System.Web.UI.WebControls.Label Gonext;
protected System.Web.UI.WebControls.Label Hitcount;
protected System.Web.UI.WebControls.Table Table1;
protected System.Web.UI.WebControls.Button SaveIt;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
protected System.Web.UI.WebControls.Label Postold;
protected System.Web.UI.WebControls.Label TopicWithMe;
public View()
{
Page.Init += new System.EventHandler(Page_Init);
} public string fbId;
public string Id;
public string cPage;
public string Title;
public DataRow[] Config;
public DataRow[] Board; private void SetModel()
{
Config=Db.Config.Table.Select("Forum_Config_Active='1'");
Id=Request.Params["Id"];
cPage="1";
if(Request.Params["Page"]!=null)
{
cPage=Request.Params["Page"];
}
fbId=Request.Params["fbId"];
if(fbId!=null && fbId!="")
{
Board=Db.Board.Table.Select("Forum_Board_Id="+Int32.Parse(fbId));
if (Board[0]["Forum_Board_Hidden"].ToString()=="1")
{
if( Session[fbId]!= null)
{
if(Session[fbId].ToString()!="1" )
{
Response.Redirect("HiddenLogin.aspx?fbId="+fbId);
}
}
else
{
Response.Redirect("HiddenLogin.aspx?fbId="+fbId);
}
}
}
string DirPath=NowPath()[0];
string DirInfo=NowPath()[1];
Title=Config[0]["Forum_Config_Name"].ToString()+"--"+DirPath+" 浏览:"+DirInfo;
}
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
SetModel();
DirPath();
SetConfig();
IsValidate();
ExeInfo();
ForumInfo();
ShowStates();
}
} private void ExeInfo()
{
Db List=new Db();
string Sql="update Forum_Info set Forum_Info_Hit=Forum_Info_Hit+1 where Forum_Info_Id="+Id;
try
{
List.ExeSql(Sql);
}
catch
{}
} private string[] NowPath()
{
string Sql;
string[] GetName=new String[2];
Db List=new Db();
Sql="select Forum_Board_Name from Forum_Board where Forum_Board_Id="+fbId;
SqlDataReader Name=List.GetList(Sql);
Name.Read();
GetName[0]=Name.GetString(0);
Name.Close();
Sql="select Forum_Info_Title,Forum_Info_Hit from Forum_Info where Forum_Info_Id="+Id;
SqlDataReader Info=List.GetList(Sql);
Info.Read();
GetName[1]=Info.GetString(0);
Hitcount.Text=(Info.GetInt32(1)+1).ToString();
Info.Close(); return GetName;
} private void DirPath()
{
string DirPath=NowPath()[0];
string DirInfo=NowPath()[1];
Db List=new Db();
Path.Text="<a href='Index.aspx'>"+Config[0]["Forum_Config_Name"]+"</a> >> <a href='List.aspx?fbId="+fbId+"'>"+DirPath+"</a> >> <a href='View.aspx?fbId="+fbId+"&Id="+Id+"'>"+List.ReplaceBadWord(DirInfo)+"</a>";
TopicWithMe.Text="<a href='MyTopic.aspx?Type=1'>我参与的话题</a> | <a href='MyTopic.aspx?Type=2'>已被回复的我的发言</a>";
string OnlineName="客人";
string OnlineClass="0";
if (Request.Cookies["UsersName"]!=null)
{
if(Request.Cookies["UsersName"].Value!="")
{
OnlineName=Request.Cookies["UsersName"].Value;
OnlineClass=Request.Cookies["UsersClass"].Value;
}
}
string Action="浏览 "+DirInfo;
List.GetOnline(DirPath,Action,Request.UserHostAddress,Request.UserAgent,OnlineName,OnlineClass);
} private void IsValidate()
{
Db List=new Db();
string Sql = "select Forum_Board_Password from Forum_Board where Forum_Board_Id='"+fbId+"'";
SqlDataReader Password = List.GetList(Sql);
Password.Read();
string pass = Password.GetString(0);
if (pass != "" && pass != null)
{
if (Request.Cookies["PassBoard"].Value = null || Request.Cookies["PassBoard"].Value = "")
{
Response.Redirect("Pass_Board.aspx?ID='" + fbId + "'&Pass='" + pass + "'");
}
else
{
if (pass != Request.Cookies["PassBoard"].Value)
{
Response.Redirect("Pass_Board.aspx?ID='" + fbId + "'&Pass='" + pass + "'");
}
}
}
} private void ForumInfo()
{
if (Int32.Parse(cPage)>=1)
{
dgfiList.CurrentPageIndex=Int32.Parse(cPage)-1;
}
else
{
dgfiList.CurrentPageIndex=0;
}
Db List=new Db();
string Sql="select * from Forum_Info inner join Forum_Users on Forum_Info.Forum_Info_Users=Forum_Users.Forum_Users_Name where Forum_Info.Isdel='0' and (Forum_Info_RootId="+Id+" or Forum_Info_Id="+Id+") order by Forum_Info_RootId ,Forum_Info_Id";
dgfiList.DataSource=List.GetGrid(Sql,"Forum_Info");
dgfiList.DataBind();
cInfo();
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="read.aspx.cs" Inherits="read" %>.ascx.cs是一些UserControl的定义
对应啊,页面头部的信息为:
<%@ Page language="c#" Codebehind="View.aspx.cs" AutoEventWireup="false" Inherits="Forum.View" %>
<%@ Register TagPrefix="Forum" TagName="Bt" Src="_Bt.ascx" %>
<%@ Register TagPrefix="Forum" TagName="Top" Src="_Top.ascx" %>[color=#FF0000]可是把“View.aspx.cs”文件删除了,都不影响功能啊!无语只要不删除“View.aspx”文件就行
[/color]
(1)你是直接页面->游览器游览,这个是到不了断点的。
(2)你按F5运行,但是你的断点的代码段并没有走到。
第一,没有直接“直接页面->游览器游览”。
第二,是点的“启动调试”,把“.cs文件”删除了都没有印象啊?
还有看看是不是在调试状态以及页面运行的cs是否正确
_Bt.ascx
_Top.ascx
实际请求的是Forum.dll
Reflector吃饭
你看到的cs文件不就是反编出来的源码,删掉bin之后调试就行了,当然可以修改