簡體   English   中英

ASP.NET即使在調試中也不會調用代碼

[英]ASP.NET not calling code behind even in debug

就像它說的那樣,當我在調試中運行我的應用程序時,后台代碼不會被調用。

我遇到了這個問題,並且設法放棄了我正在處理的頁面並開始了一個全新的頁面來解決這個問題。

但是似乎這一個現在也壞了!

基本上,它只是打開以顯示未更改的HTML,而不運行任何C#代碼,也不會遇到任何斷點。

它可以正常運行,但由於目前沒有可用的服務器,因此我還沒有嘗試部署它。

這是index.aspx.cs背后的代碼:

namespace PAPS
{
    public partial class index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        { 
            string username = User.Identity.Name;
            // check security
            Security security = new Security(username);
            divUsername.InnerText = username;
            security = null;
        }
    }
}

index.aspx中的頁面聲明如下:

<%@ Page Language="C#" AutoEventWireup="false" EnableSessionState="True" EnableViewState="false" CodeBehind="index.aspx.cs" Inherits="PAPS.index" %>

有人有什么有用的建議嗎?

謝謝

你有

AutoEventWireup = false

除非您自己處理事件,否則請嘗試將其設置為true。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM