Guest User

Untitled

a guest
Jun 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.OleDb;
  12.  
  13. public partial class Login : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (Request.Form["send"] != null)
  18.         {
  19.             string us = Request.Form["user_name"];
  20.             string pass = Request.Form["password"];
  21.  
  22.             OleDbConnection conn = new OleDbConnection(Connect.getConnectionString());
  23.             conn.Open();
  24.             string sq1 = "select username from tblUsers where username = '" + us + "' and pass = '" + pass + "'";
  25.             OleDbCommand comm = new OleDbCommand(sq1, conn);
  26.             string us2 = (string)comm.ExecuteScalar();
  27.             if (us2 == null)
  28.                 Response.Redirect("Register.aspx");
  29.             else
  30.             {
  31.                 Session["username"] = us;
  32.                 Session["pass"] = pass;
  33.                 Response.Redirect("Default.aspx");
  34.             }
  35.  
  36.  
  37.  
  38.            
  39.  
  40.         }
  41.     }
  42. }
Add Comment
Please, Sign In to add comment