how to make simple login form in c#
and making simple form registration system
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhishek JaiswalPosted Mar 17, 2015, 6:03 AM
Here's a solution
http://www.c-sharpcorner.com/UploadFile/2072a9/creating-log-insign-in-page-using-net-framework/
:)
sumayya pPosted Mar 17, 2015, 5:06 AM
/*....................You can do this like..............................*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Net;
using System.Net.Mail;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MultiView1.SetActiveView(View1);
}
}
provider_Registration p = new provider_Registration();
container_reg c = new container_reg();
protected void Button1_Click(object sender, EventArgs e)
{
dbop op = new dbop();
Session["user_id"] = TextBox1.Text;
Session["password"] = TextBox2.Text;
DataTable dt=new DataTable();
dt = op.ret("select * from Registration where user_id='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'");
if (dt.Rows.Count > 0)
{
DataRow dr = dt.Rows[0];
Session["id"] = TextBox1.Text;
Response.Redirect("Home.aspx");
}
else
{
Label2.Visible = true;
//Response.Write("");
}
}
protected void LinkButton1_Click1(object sender, EventArgs e)
{
MultiView1.SetActiveView(View2);
}
protected void Button2_Click(object sender, EventArgs e)
{
DataTable dt=new DataTable();
c.puser_id = Convert.ToInt32(TextBox3.Text);
c.pmobile_no = Convert.ToInt64(TextBox4.Text);
dt=p.sel(c);
if (dt.Rows.Count > 0)
{
DataRow dr = dt.Rows[0];
string pwd = dr[1].ToString();
string eml = dr[0].ToString();
//Label1.Text = pwd;
try
{
string email = "";
string password = "";
MailMessage msg = new MailMessage("[email protected]", eml);
msg.Subject = "Password Recovery";
msg.Body = "Yor password=" + pwd;
SmtpClient cl = new SmtpClient("smtp.gmail.com", 587);
cl.EnableSsl = true;
cl.Credentials = new NetworkCredential("[email protected]", "ziya1234");
cl.Send(msg);
}
catch
{
}
}
else
{
Label1.Visible = true;
Label1.Text = "Incorrect User ID or Mobile Number";
//Response.Write("");
}
}
}
Khargesh RajputPosted Mar 17, 2015, 5:05 AM