有一个“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();
}

解决方案 »

  1.   

    简单的说 ,private void Page_Load 这个是入口。修改代码后是需要编译一下才能生效。如果编译了还没有生效,那么就检查一下是不是找错(看错)页面了。还有IIS的设置。
      

  2.   

    页面是“View.aspx”没错,但是注释掉了“View.aspx.cs”中的代码后,对“View.aspx”页面的显示没有一点影响???       太不靠谱了,神奇,到底是怎么回事???
      

  3.   

    看一下View.aspx页面的CodeFile
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="read.aspx.cs" Inherits="read" %>.ascx.cs是一些UserControl的定义
      

  4.   

    检查view的inherits,重新发布编译
      

  5.   


    对应啊,页面头部的信息为:
    <%@ 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]
      

  6.   

    刚才经过测试发现一个惊人的现象,就算把网站中所有的“.cs”文件都删除了。只要保留“.aspx”文件,网站一样可以正常运行,请问这是咋回事,难道是编译的时候没有编译后台文件???
      

  7.   

    你设置好断点以后,按F5运行。
    (1)你是直接页面->游览器游览,这个是到不了断点的。
    (2)你按F5运行,但是你的断点的代码段并没有走到。
      

  8.   


    第一,没有直接“直接页面->游览器游览”。
    第二,是点的“启动调试”,把“.cs文件”删除了都没有印象啊?
      

  9.   

    你的论坛是不是生成静态页面了?private void ExeInfo()右击ExeInfo 查看所有引用。看看哪个地方引用的。把你的HTML发上来看看吧。
      

  10.   

    Page_Load
    还有看看是不是在调试状态以及页面运行的cs是否正确
      

  11.   

     Inherits="Forum.View"应该在用户控件里跟踪
    _Bt.ascx
    _Top.ascx
      

  12.   

    也不对啊,codebehind指定的cs删除了怎么可能正常浏览呢
      

  13.   

    下了你哪个源码看了,这是个已编译的
    实际请求的是Forum.dll
      

  14.   

    用反编译软件 
    Reflector吃饭
      

  15.   


    你看到的cs文件不就是反编出来的源码,删掉bin之后调试就行了,当然可以修改