/// <summary> /// Method Name:BtnError_Click /// Description:Error Handling Message show /// Author:Bhumi /// Created on:30/6/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnError_Click(object sender, EventArgs e) { String line; StreamReader sr; try { objconst = new ConstantMessages(); //Pass the file path sr = new StreamReader(objconst.strNotExistFile); //Read the text line = sr.ReadToEnd(); Response.Write(line); sr.Close(); } catch (FileNotFoundException exe) { Response.Write(exe.Message);//Error Message } catch (Exception ex) { Response.Write(ex.Message);//Error Message } finally { objconst = null; } }
/// <summary> /// Method Name:BtnDisplay_Click /// Description:Stored information of browser in Cache Objects Display On Web Page /// Author:Bhumi /// Created on:1/7/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnDisplay_Click(object sender, EventArgs e) { ConstantMessages objconst; try { objconst = new ConstantMessages(); if ((Cache["Name"] as string) != null && (Cache["Version"] as string) != null) { Response.Write(objconst.strBrowserName + " <B>" + Server.HtmlEncode(Cache["Name"] as string) + "</B><br/>"); //Browser name Response.Write(objconst.strBrowserVersion + " <B>" + Server.HtmlEncode(Cache["Version"] as string) + "</B><br/>"); //Version } if ((Cache["CurrentDate"] as string) != null) { Response.Write(objconst.strCurrentDate + " <B>" + Server.HtmlEncode(Cache["CurrentDate"] as string) + "</B>");//Date } if ((Cache["Name"] as string) == null && (Cache["Version"] as string) == null && (Cache["CurrentDate"] as string) == null) { Response.Write(objconst.strEmptyCache);//Null Cache Objects } } catch (Exception ex) { Response.Write(ex.Message); } finally { objconst = null; } }
/// <summary> /// Method Name:Page_Error /// Description:Exception Handling Method /// Author:Bhumi /// Created on:30/6/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Error(object sender, System.EventArgs e) { objconst = new ConstantMessages(); // Write a message to the trace log. Trace.Warn("Error", "", Server.GetLastError()); // Clear the error so the application can continue. Server.ClearError(); // Redisplay the page. Response.Redirect(objconst.strpageEx11); }
protected void Page_Load(object sender, EventArgs e) { objconst = new ConstantMessages(); if (Session["Error"] != null) { LblError.Text = objconst.strErrormsg + Session["Error"].ToString(); // Clear the Session variable. Session["Error"] = null; } }
/// <summary> /// Method Name:BtnError_Click /// Description:Error Handling Message show /// Author:Bhumi /// Created on:30/6/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnError_Click(object sender, EventArgs e) { String line; StreamReader sr; objconst = new ConstantMessages(); //Pass the file path sr = new StreamReader(objconst.strNotExistFile); //Read the text line = sr.ReadToEnd(); Response.Write(line); sr.Close(); }
protected void BtnRead_Click(object sender, EventArgs e) { String line; StreamReader sr; objconst = new ConstantMessages(); //Pass the file path sr = new StreamReader(Server.MapPath(objconst.strExistFile)); //Read the text line = sr.ReadToEnd(); Response.Write("<h3>File Data:</h3><br/>" + line); sr.Close(); }
/// <summary> /// Method Name:BtnSubmit_Click /// Description:Store Login Details in session Variables and check Authentication of user /// Author:Bhumi /// Created on:1/7/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSubmit_Click(object sender, EventArgs e) { SqlConnection sqlconn; ConstantMessages objconst; SqlCommand sqlcmd; object UserName_Password_Exist; sqlconn = new SqlConnection(); StringBuilder strBrSelectQuery; try { //connectionstring sqlconn.ConnectionString = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; if (sqlconn != null && sqlconn.State == ConnectionState.Closed) { sqlconn.Open();//open the connection } //Existance in Employees_Temp Table strBrSelectQuery = new StringBuilder("SELECT FirstName,LastName "); strBrSelectQuery.Append(" FROM Employees_Temp"); strBrSelectQuery.Append(" WHERE FirstName='" + TxtUserName.Text + "' COLLATE Latin1_General_CS_AS AND LastName='" + TxtPassword.Text + "' COLLATE Latin1_General_CS_AS ;"); sqlcmd = new SqlCommand(strBrSelectQuery.ToString(), sqlconn); UserName_Password_Exist = sqlcmd.ExecuteScalar(); if (UserName_Password_Exist != null) { //Store Details in Sessio Variables Session["UserName"] = TxtUserName.Text; objconst = new ConstantMessages(); Response.Redirect(objconst.strSecurepage); } else { LblInvalid.Visible = true; } } catch (Exception ex) { Response.Write(ex.Message); } finally { if (sqlconn.State == ConnectionState.Open) { sqlconn.Close(); } objconst = null; sqlcmd = null; strBrSelectQuery = null; } }
/// <summary> /// Method Name:Page_Load /// Description:If Successful login completed redirect to this page /// Author:Bhumi /// Created on:1/7/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { try { LblMessage.Visible = false; if (Session["UserName"] != null) { LblMessage.Visible = true;//show message } else { objconst = new ConstantMessages(); Response.Redirect(objconst.strLoginpage);//Redirect to login page } } catch (Exception ex) { Response.Write(ex.Message); } finally { objconst = null; } }
protected void Page_Load(object sender, EventArgs e) { objconst = new ConstantMessages(); Response.Write("<B>" + objconst.strnestedmaster + "</B>"); }