Himanshu Tyagi

Himanshu Tyagi

  • NA
  • 119
  • 15.7k

Worked on Dev. server whereas on Production issue occured

Jul 30 2018 2:27 AM
Faced issue while switching to any page after login successfully everytime. It requires login credential everytime whereas i maintained session state properly.
 
Worked Perfectly on Development server whereas on Production issue occur. Please suggest
 
Login Page -
 
protected void btnLogin_Click(object sender, EventArgs e)
{
String strCheckStatus = String.Empty;
g_strContact = txtPhone.Text;
String strLoginPassword = txtPassword.Text;
List parameters = new List
{
new SqlParameter("@P_MOBILE_NO", g_strContact),
new SqlParameter("@P_PASSWORD", strLoginPassword),
};
strCheckStatus = ExecuteQueryStoredProcedure(strUSP_SEC_LOGIN_PROCESS, parameters);
if (strCheckStatus == "0")
{
//login successfull
Session["Name"] = g_strName;
Session["MobileNumber"] = g_strContact;
Session["SlabType"] = g_strSlabType;
Session["UserType"] = g_strUserType;
Session["AssociateMobileNo"] = g_strContact;
if (g_strUserType == "Admin")
{
FormsAuthentication.RedirectFromLoginPage(Session["MobileNumber"].ToString(), false);
}
}
Session maintain in every page in Page Load event-
protected void Page_Load(object sender, EventArgs e)
{
if (Session["MobileNumber"] != null)
{
lblMobile.Text = Session["MobileNumber"].ToString();
}
else
{
var returnUrl = Server.UrlEncode(Request.Url.PathAndQuery);
Response.Redirect("~/Login.aspx?ReturnURL=" + returnUrl);
}
if (!this.IsPostBack)
{
PopulateGrid();
PopulateData();
}
}

Answers (12)