/
adlogin.aspx.cs
47 lines (43 loc) · 1.21 KB
/
adlogin.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class adlogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethod(EnableSession = true)]
public static string Validate(string uname, string pwd)
{
try
{
if (uname == null && pwd == null)
return "fail";
Class1 cn = new Class1();
DataSet ds = new DataSet();
ds = cn.getdata("select * from Admin_mst where Admin_Name='" + uname + "' and Admin_Pass='" + pwd + "'");
if (ds.Tables[0].Rows.Count == 1)
{
HttpContext.Current.Session["username"] = uname;
return "success";
}
else
{
return "fail";
}
}
catch (Exception ex)
{
return "fail";
}
}
}