<div class="main-content-agile">
<div class="sub-main-w3">
<h2>Sign In</h2>
<asp:Label ID="Sta" runat="server"></asp:Label>
<form runat="server">
<h6>Swiftly sign in with</h6>
<div class="navbar-right social-icons">
<a href="#" class="one-w3ls" ><i class="fa fa-facebook" aria-hidden="true"></i> Facebook</a>
<a href="#" class="two-w3ls" ><i class="fa fa-google-plus" aria-hidden="true"></i>Google+</a>
<div class="clear"></div>
</div>
<h6>Or use your email</h6>
<div class="icon1">
<input placeholder="Email" name="emailid" type="email" required="">
</div>
<div class="icon2">
<input placeholder="Password" name="Pass" type="password" required="">
</div>
<label class="anim">
<input type="checkbox" class="checkbox">
<span>Remember Me</span>
<a href="#">Forgot Password</a>
</label>
<div class="clear"></div>
<asp:Button ID="InsertButton" runat="server" Text="Submit" OnClick="insert"/>
</form>
</div>
my .cs code throwing nullreferenceexception
protected void insert(object s, EventArgs e)
{
string email = Request.Form["emailid"];
string password = Request.Form["pass"];
try
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["akshay.mdf"].ConnectionString);
con.Open();
String insertval = "INSERT INTO Table(email,password) VALUES(@email,@password)";
SqlCommand cmd = new SqlCommand(insertval, con);
cmd.Parameters.AddWithValue("@email", email);
cmd.Parameters.AddWithValue("@password", password);
cmd.ExecuteNonQuery();
con.Close();
Sta.Text = "Record Inserted Succesfully";
}
catch (Exception ex)
{
throw ex;
}