2010-10-19 116 views
1

我正在使用Visual Studio 2005和IIS 6.0 ..我在事件日誌中有此警告。我試圖找到它是什麼。當我工作時,我從來沒有經歷過這個例外。 可以做些什麼以及在哪裏可以做到不再發生異常警告。提前感謝!事件日誌有錯誤。 「發生了未處理的異常」

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 10/13/2010 3:20:26 PM 
Event time (UTC): 10/13/2010 7:20:26 PM 
Event ID: fba7eb72412b4383a4c94bfcfd5c81a1 
Event sequence: 708 
Event occurrence: 6 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/568802591/Root-1-129314697219905000 
    Trust level: Full 
    Application Virtual Path:/
    Application Path: C:\Inetpub\wwwroot\kjdfd.live\ 
    Machine name: VME1053 

Process information: 
    Process ID: 472 
    Process name: w3wp.exe 
    Account name: NT AUTHORITY\NETWORK SERVICE 

Exception information: 
    Exception type: NullReferenceException 
    Exception message: Object reference not set to an instance of an object. 

Request information: 
    Request URL: https://www.kjdfd.com:443/UserTownPage.aspx?tid=0 
    Request path: /UserTownPage.aspx 
    User host address: 173.188.124.86 
    User: 
    Is authenticated: False 
    Authentication Type: 
    Thread account name: NT AUTHORITY\NETWORK SERVICE 

Thread information: 
    Thread ID: 11 
    Thread account name: NT AUTHORITY\NETWORK SERVICE 
    Is impersonating: False 
    Stack trace: at UserTownPage.Page_Load(Object sender, EventArgs e) 
    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) 
    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) 
    at System.Web.UI.Control.OnLoad(EventArgs e) 
    at System.Web.UI.Control.LoadRecursive() 
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 


Custom event details: 

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. 

頁面加載:

protected void Page_Load(object sender, EventArgs e) 
    { 
     if (!Page.IsPostBack) 
     { 
      SearchType = CommonHelper.SearchInnerType.Distance; 
      MakeActive(SearchType); 
      LoadData(true); 
     } 
    } 

private void MakeActive(CommonHelper.SearchInnerType sType) 
    { 
     DealsActive.Attributes.Remove("class"); 
     PopularActive.Attributes.Remove("class"); 
     DistanceActive.Attributes.Remove("class"); 
     AZActive.Attributes.Remove("class"); 
     switch (sType) 
     { 
      case CommonHelper.SearchInnerType.A_Z: 
       AZActive.Attributes.Add("class", "current"); 
       break; 
      case CommonHelper.SearchInnerType.Distance: 
       DistanceActive.Attributes.Add("class", "current"); 
       break; 
      case CommonHelper.SearchInnerType.Popular: 
       PopularActive.Attributes.Add("class", "current"); 
       break; 
      case CommonHelper.SearchInnerType.Deals: 
       DealsActive.Attributes.Add("class", "current"); 
       break; 
      default: 
       AZActive.Attributes.Add("class", "current"); 
       break; 
     } 

    } 



private void LoadData(bool isSetPageIndex) 
    { 
     if (Session["keyword"] != null && Session["city"] != null && Session["state"] != null 
      && Session["zipcode"] != null && Session["radius"] != null && Session["category"] != null) 
     { 
      string keyword = Session["keyword"].ToString(); 
      string city = Session["city"].ToString(); 
      string state = Session["state"].ToString(); 
      string zipCode = Session["zipcode"].ToString(); 
      double radius = Convert.ToDouble(Session["radius"].ToString()); 
      int categoryID = Convert.ToInt32(Session["category"].ToString()); 
      if (isSetPageIndex) PageIndex = 1; 
      DisplayRecords(keyword, city, state, zipCode, radius, categoryID, 1); 
     } 
    } 
+0

您可以粘貼UserTownPage.Page_Load的代碼嗎? – 2010-10-19 15:18:32

+0

在web.config中啓用調試編譯,這將確保您會看到在什麼行上引發異常 – Onkelborg 2010-10-19 15:22:19

+0

謝謝所有人的關注!我用Pageload()和函數調用了它的問題。如果您需要其他信息,請告訴我。 – Ram 2010-10-19 15:56:43

回答

4

這個問題似乎是NullReferenceException被拋出insed的UserTownPage類型的Page_Load方法。不止如此,不能從所提供的信息中確定。

你需要做的是調試到該方法,並確切地看到空引用發生的位置。

相關問題