I have developed an application in Asp.Net 3.5. In this, I have used 4-tier architecture.
Server Detail
Application hosted on Windows Server 2008 64bit OS with IIS 7. Server is having 32GB of RAM, and 200GB of hard drive.
Both publish Application and database hosted on same server.
Problem
I have one Review form where in I am trying to submit the review of Employee.
When single user logging in to the application on web server, application is working fine. User is able to submit their reviews. But as soon as it increases to more than one, it creates problem. Let's say, suppose more than one user is clicking on Submit button at a time to submit Review then only one employees record is storing on database rest all users data are not storing, but all Users are getting a message saying "Submitted Successfully".
Also I checked the error in Event Log, and I am getting a message like below.
Event code: 3005 Event message: An unhandled exception has occurred. Event time: 3/6/2013 11:53:37 AM Event time (UTC): 3/6/2013 6:23:37 AM Event ID: e417857a86074b16bbf05bce818a5b0d Event sequence: 11 Event occurrence: 1 Event detail code: 0
Application information: Application domain: /LM/W3SVC/1/ROOT/spmstest-2-130070176529122850 Trust level: Full Application Virtual Path: /spmstest Application Path: C:\hrpmsapp\PMSPublished Test\ Machine name: INDW00029
Process information: Process ID: 9320 Process name: w3wp.exe Account name: IIS APPPOOL\DefaultAppPool
Exception information: Exception type: NullReferenceException Exception message: Object reference not set to an instance of an object.
Request information: Request URL: Request path: User host address: User: Is authenticated: False Authentication Type: Thread account name: IIS APPPOOL\DefaultAppPool
Thread information: Thread ID: 10 Thread account name: IIS APPPOOL\DefaultAppPool Is impersonating: False Stack trace: at ASP.global_asax.Session_End(Object sender, EventArgs e)
Custom event details:
Please find the sample code below.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using PMS.BO;
using PMS.BAL;
using System.Data.OleDb;
public partial class Reviews_DevelopmentReview : System.Web.UI.Page
{
ClsUtility cUtil = new ClsUtility();
ClsDevRevBAL DevRevBAL = new ClsDevRevBAL();
ClsDevRevBO DevRevBO = new ClsDevRevBO();
ClsObjectiveBAL ObjBAL = new ClsObjectiveBAL();
ClsMailSetBO MailSetBO = new ClsMailSetBO();
ClsMailSetBAL MailSetBAL = new ClsMailSetBAL();
static DataSet dsDevRevGridHead;
static DataTable dtDataForMail;
static int DevRevCode = 0;
int EmpRating = 0; int MgrRating = 0;
int result;
static int StatusCode;
static bool isFiveRatingApplicable = false;
static string companyId = string.Empty;
static string JobRoleId = string.Empty;
static string EmpCode = string.Empty;
static int loginEmpCode;
static string LoginType = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserID"] == null)
{
Response.Redirect("../Default.aspx?Session=expired");
}
LoginAuthentication loginAuth = new LoginAuthentication();
LoginVariables loginVar = loginAuth.getSession();
if (!Page.IsPostBack)
{
companyId = loginVar.CompanyId;
if (Request.QueryString.Count > 0)
{
if (Request.QueryString["Id"].ToString() != null)
{
dtDataForMail = cUtil.GetEmpDetail(int.Parse(Request.QueryString["Id"].ToString()));
EmpCode = Request.QueryString["Id"].ToString();
loginEmpCode = int.Parse(loginVar.EmployeeID);
LoginType = "Manager";
}
isFiveRatingApplicable = cUtil.GetIsFiveRatingApplicable(EmpCode);
StatusCode = DevRevBAL.GetStatusCode(EmpCode);
switch (StatusCode)
{
case 2:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
break;
case 3:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Visible = true;
break;
case 4:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Enabled = false;
if (companyId == "0")
{
btnFinalize.Visible = true;
btnFinalize.Enabled = true;
txtHrComment.Enabled = true;
}
break;
case 5:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Enabled = false;
break;
default:
break;
}
}
else
{
EmpCode = loginVar.EmployeeID;
loginEmpCode = int.Parse(loginVar.EmployeeID);
LoginType = "Employee";
isFiveRatingApplicable = cUtil.GetIsFiveRatingApplicable(EmpCode);
StatusCode = DevRevBAL.GetStatusCode(EmpCode);
switch (StatusCode)
{
case 1:
btnSubmit.Visible = false;
btnSubmitLater.Visible = false;
btnFinalize.Visible = false;
txtEmpAreaForSkill.ReadOnly = true;
txtEmpAreaForDev.ReadOnly = true;
break;
case 2:
btnSubmit.Visible = false;
btnSubmitLater.Visible = false;
btnFinalize.Visible = true;
txtEmpAreaForSkill.ReadOnly = true;
txtEmpAreaForDev.ReadOnly = true;
txtEmployeeComment.ReadOnly = false;
break;
case 3:
btnSubmit.Visible = false;
btnSubmitLater.Visible = false;
btnFinalize.Enabled = false;
txtEmpAreaForSkill.ReadOnly = true;
txtEmpAreaForDev.ReadOnly = true;
txtEmployeeComment.ReadOnly = true;
break;
case 4:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Enabled = false;
break;
case 5:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Enabled = false;
break;
default:
break;
}
}
DataTable dtData = cUtil.GetEmpDetail(int.Parse(EmpCode));
txtEmployee.Text = dtData.Rows[0]["EmpName"].ToString();
txtBranch.Text = dtData.Rows[0]["Branch"].ToString();
txtDesignation.Text = dtData.Rows[0]["Designation"].ToString();
txtManager.Text = dtData.Rows[0]["Approver"].ToString();
JobRoleId = dtData.Rows[0]["JobRoleId"].ToString();
if (dtData.Rows[0]["Status"].ToString() != "True")
{
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/selectedtab1.png", Value = "0", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab2.png", Value = "1", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab4.png", Value = "3", Text = "" });
}
else
{
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/selectedtab1.png", Value = "0", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab2.png", Value = "1", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab3.png", Value = "2", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab4.png", Value = "3", Text = "" });
}
Menu1.Items[0].Selected = true;
FillDevRevGridView();
FillTrainingListBox();
if (isFiveRatingApplicable == true)
{
// For Competencies Section
trRatingInstruction.Visible = false;
// For Development Actions Section
tblForFiveRating1.Visible = true;
// For Development Targets Section
lblDomesticMob.Visible = true;
rdDomMobStatus.Visible = true;
tblForFiveRating2.Visible = true;
// For Comments Section
lblHrComment.Visible = true;
txtHrComment.Visible = true;
}
}
EnableDisableControls();
}