我有现场网站。在登录到管理模块时,我收到了这个错误。过去几天我的网站运行良好。没有任何新的上传副本我收到此错误。“/”应用程序中的服务器错误。
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 73: <div id="ctl00_pnlloginname" style=" float:right; width:auto; padding-left:2px; padding-top:3px; padding-right:5px; height:20px;">
Line 74:
Line 75: Welcome <span class="subtitle"><span id="ctl00_lblloginname12"><asp:Label ID="lbldisplayname" runat="server"></asp:Label></span></span> | Online Users Found : <span class="subtitle"><asp:Label ID="lblonlineusers" runat="server"><%= Application["OnlineUsers"].ToString()%></asp:Label></span> | You Have <asp:Label ID="lblnewunreadmail" runat="server" CssClass="subtitle"></asp:Label> unread email in <a href="Pop3Client.aspx" class="subtitle">Gmail Inbox</a> | <a href="Report.aspx" class="subtitle">Track Report</a></div></td>
Line 76: <tr>
Line 77: <td height="34" align="center" valign="top" class="menu_bg">
Source File: c:\hostingspaces\ominvest\ominvestment.co.in\wwwroot\Admin\MasterPage.master Line: 75
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
ASP.admin_masterpage_master.__Renderlblonlineusers(HtmlTextWriter __w, Control parameterContainer) in c:\hostingspaces\ominvest\ominvestment.co.in\wwwroot\Admin\MasterPage.master:75
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.WebControls.Label.RenderContents(HtmlTextWriter writer) +8697071
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266
Version Information: Microsoft .NET Framework Version:2.0.50727.5466; ASP.NET Version:2.0.50727.5456
我不知道那是什么问题。
全球.asax
string _pagePath;
void Application_Start(object sender, EventArgs e)
{
Server.ClearError();
Application["OnlineUsers"] = 0;
// Caching the tracker image in memory
byte[] trackerImg = File.ReadAllBytes(Context.Request.MapPath(ConfigurationManager.AppSettings["SD_Tut_ImageFileLocation"]));
Application[ConfigurationManager.AppSettings["SD_Tut_ImageFileKeyName"]] = trackerImg;
// Creating a new request queue collection
int queueCapacity = Convert.ToInt32(ConfigurationManager.AppSettings["SD_Tut_TrackerRequestsToCache"]);
Queue<TrackerRequest> trackerReqQueue = new Queue<TrackerRequest>(queueCapacity);
Application[ConfigurationManager.AppSettings["SD_Tut_TrackerCachedRequestsKeyName"]] = trackerReqQueue;
}
void Session_Start(object sender, EventArgs e)
{
Session["username"] = Server.HtmlEncode(User.Identity.Name);
if (Session.IsNewSession && Session["username"] == null)
{
_pagePath = Server.MapPath("Default.aspx");
Response.Redirect(_pagePath);
}
Application.Lock();
Application["OnlineUsers"] = (int)Application["OnlineUsers"] + 1;
Application.UnLock();
}
void Session_End(object sender, EventArgs e)
{
Application.Lock();
Application["OnlineUsers"] = (int)Application["OnlineUsers"] - 1;
Session.Remove("username");
Session.Clear();
Application.UnLock();
}