protected void buttonAddKey_Click(object sender, EventArgs e) { if (textboxKey.Text.Length > 0) { string emailId = Session["EMAILID"].ToString(); string fileName = Session["PortfolioFolder"].ToString() + "\\" + emailId + ".key"; StockApi.createKey(fileName, textboxKey.Text); } else { //Response.Redirect(".\\Default.aspx"); //Response.Write("<script language=javascript>alert('Enter valid key')</script>"); Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + common.noValidKey + "');", true); } }