need code for login in asp.net with c#

need code for login in asp.net with c#

hai iam trying to develop a project in asp.net with c#,so i need a code for login page using which admin and other users can log in.plz help me, thanks in advance.

View Answers

April 1, 2013 at 11:48 AM

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.Configuration;
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
string username = Login1.UserName;
string pwd = Login1.Password;
string s;
s = WebConfigurationManager.ConnectionStrings["ChartDatabaseConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(s);
con.Open();
string sqlUserName;
sqlUserName = "SELECT user_name,password FROM Login WHERE user_name ='" + username + "' AND password ='" + pwd + "'";
SqlCommand cmd = new SqlCommand(sqlUserName, con);
string CurrentName;
CurrentName = (string)cmd.ExecuteScalar();
if (CurrentName != null)
{
Session["UserAuthentication"] = username;
Session.Timeout = 1;
Response.Redirect("start.aspx");
}
else
{
Session["UserAuthentication"] = "";
}
}
}









Related Tutorials/Questions & Answers:
need code for login in asp.net with c#
need code for login in asp.net with c#  hai iam trying to develop a project in asp.net with c#,so i need a code for login page using which admin and other users can log in.plz help me, thanks in advance
login page code in asp.net
login page code in asp.net  i need front end and backend code for login page in vb asp.net using sql server....having code for submit button
Advertisements
Asp.net with C#
Asp.net with C#  Autopopulate values into textbox from database on pressing tab
asp.net
file......is it any solution of this problem. the code language is asp.net & c...asp.net  My project requrement is when somebuddy fill a web form
need of code
need of code  howto convert greyscale image to binary image in java
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
c code
c code  c code for this formula x=(y-0.22z-072)4; where y=7.32 x=3.1 then ans x=23.9 end code
c code
c code  c code for this formula x=(y-0.22z-072)4; where y=7.32 x=3.1 then ans x=23.9 end code for this   c code for this formula x=(y-0.22z-072)4; where y=7.32 x=3.1 then ans x=23.9 can any one end code
C# code
C# code  hi pls clear my doubts this is my code but out is not well through this code i need display a particular row to a particular columns pls... bbbb 301 55 Pass bbbb 302 22 Fail bbbb i need result like
swing login code
swing login code  code for the login form
ASP.NET
ASP.NET  How to get multiple values of single textbox separated by commas using C
need a login applet in java
need a login applet in java  i'm java beginner. Can some java master teach me how to write a login applet? combine with my coding import javax.swing.*; import java.applet.*; import java.awt.*; import java.util.*; import
need a login applet in java
need a login applet in java  i'm java beginner. Can some java master teach me how to write a login applet? combine with my coding import javax.swing.*; import java.applet.*; import java.awt.*; import java.util.*; import
asp.net
asp.net  i am generating excel file through data base, in excel cell text are displaying with green triangle on the corner, how to convert text to number through c sharp coding
php login and logout code
php login and logout code  Hi, Can anyone share there code for creating a user login and logout page in PHP?or any useful tutorial that can help to create a login and logout application in PHP.. Thanks in Advance
Need urgent help with C++ errors!
Need urgent help with C++ errors!  hi, i'm new to C++ programming. this is my code... i'm using Turbo C++. It's showing so many errors!.. I...' Fatal XYZ.CPP 2: Unable to create output file 'C:\XYZ.obj' somebody please
code for login fom - Struts
code for login fom  we have a login form with fields USERNAME: PASSWORD: In this admin can login and also narmal uses can log
Asp.net
Asp.net  how to show an output of an Asp.net project work on a mobile phone
asp.net
asp.net  which place can use the WCF in most of the ASP.net projects
asp.net
asp.net  how to make online library management system using asp.net
EasyEclipse for C and C++
EasyEclipse for C and C++       EasyEclipse for C and C++ is all you need to start developing C and C++ code with Eclipse. There are currently 28 comments
Need sample code
Need sample code  Need code for graph which shows the performance comparission of aprior algorithm and coherent rule algorithm.plz can any one help me i need in a week
ASP.NET
ASP.NET  How to autogenerate id in Letters with numbers
need JSP Code.
need JSP Code.  **Hi I need JSP code for selling Products which are in Database. Please can any one help for this.URGENT... Thank You..! Abhijeet
Need a JSP CODE
Need a JSP CODE  *Hi I need JSP source code for selling products which are in database.. please can any one help me ..URGENT* Thank You
ASP.NET
ASP.NET  what is the use of web.config file in ASP.NET programing... application. An Asp.net application has one web.config file which keeps the configurations... States, Error Handling, Security configurations in ASP.NET web.Config file
ASP.NET
ASP.NET  How to get the value of dynamically added rows in a table using html
hi need help with C++ programming!
hi need help with C++ programming!  how do i : b. Store numbers / characters into the file (output) c. Retrieve numbers / characters from the file...; "Unable to open file"; return 0; } c) #include <iostream> #include <
HTML login page code
the complete HTML JavaScript code for User Login Page. Thanks in Advance!   ...HTML login page code  Hi all, I am writing my first HTML JavaScrip...: " + form.pwd1.value); return true; }   html registration form code
Role based login ..Need the concepts.. - JavaMail
Role based login ..Need the concepts..  Role based login how can i do...   Hi friend, This code help to solve your problem : Some points remember "login.jsp" 1)Code have two file "login.jsp" and "welcome.jsp
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly simple so I was hoping java would look more impressive. So I just need a visual
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly simple so I was hoping java would look more impressive. So I just need a visual
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly simple so I was hoping java would look more impressive. So I just need a visual
write code in c#
write code in c#  sir I want to write a save and save as code in the c#(windosForm).Please help me
asp.net
asp.net  Create a web page that has the restaurant fields like Name, Address, City, State, Phone, Website, EMail on it. Also, add a Submit button... in asp.net
code need - Java Beginners
code need  hi i want to code doing for this. If i have enter the text...)  Hi Friend, Try the following code. We hope this will help you... = new BufferedReader(new FileReader("c:/csv.txt")); Pattern pat
need code - Java Beginners
need code   i want to take the html coding. if user give a input html file the out is html coding in text file. i want to take html coding only... are sending you a sample code which will be helpful to you. import java.io.
need code for file browser
need code for file browser  hi, i need to write a code to browse the file in my computer using Jsp or java.. what is the code for file browser?   JSP Code for browsing: 1)page.jsp: <%@ page language="java" %>
Need a jsp code
Need a jsp code  I need a jsp code in which when i select a value.....please help me for this.   The given code retrieves the employee name...)For the above code, we have created following table: CREATE TABLE `employee
what is the code for login page in html
what is the code for login page in html  Hi, I am total beginner in HTML coding. I want to make a login page in HTML to understand the form coding. I think login page is goot topic to start and learn. what is the code for login
what is the code for login page in html
what is the code for login page in html  Hi, I am total beginner in HTML coding. I want to make a login page in HTML to understand the form coding. I think login page is goot topic to start and learn. what is the code for login
what is the code for login page in html
what is the code for login page in html  Hi, I am total beginner in HTML coding. I want to make a login page in HTML to understand the form coding. I think login page is goot topic to start and learn. what is the code for login
how to write a code for oracle database connection in asp.net for validation.
how to write a code for oracle database connection in asp.net for validation...;/script>   Create a new project in Visual Studio using eight C# Add reference to Oracle.DataAccess.dll file. Typically this file can be found in C
c language code
c language code  Dear Sir, Could you send me the c language codings for BOOK BANK
java - need code - Java Beginners
java - need code  i am java developer. i want to remove file from one folder and same file is paste another folder. i need this code. (java)  hi, I am sending you the code which moves the file from one folder
jsp code for storing login and logout time to an account
jsp code for storing login and logout time to an account  I need simple jsp code for extracting and storing login and logout time in a database table..plz someone help me...   Please visit the following link: http
C++ code to find Entropy
C++ code to find Entropy   consider a discrete memory less source with source s= { S0,S1,S2,S3} with probabilities P0=1/8 , P1= 1/8, P2=1/2 , P3=1/4 prove that h(s^3)=3h(s) using C++ program ? I try this but not true
Need source code - Swing AWT
Need source code  Hai, I need a source code for developing the project, title is "Face Recognition" and the backend as My-sql.... Thanks & Regards

Ads