Share on Google+Share on Google+

minu susan
need code for login in asp.net with c#
1 Answer(s)      4 years and 8 months ago
Posted in : Ajax

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.

Ads

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
ASP.NET
ASP.NET  How to get multiple values of single textbox separated by commas using C
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
asp.net
asp.net  which place can use the WCF in most of the ASP.net projects
Asp.net
Asp.net  how to show an output of an Asp.net project work on a mobile phone
asp.net
asp.net  how to make online library management system using asp.net
ASP.NET
ASP.NET  How to autogenerate id in Letters with numbers
ASP.NET
ASP.NET  How to get the value of dynamically added rows in a table using html
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
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  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
swing login code
swing login code  code for the login form
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
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
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
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
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
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 <
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
Asp.net ajax
Asp.net ajax  Hi, How I can use Ajax in Asp.net? Thanks   Hi, Please see UpdateProgress Example in ASP.NET using C#. Thanks
Tutorials   
Java Spring Hibernate Struts Training Ajax java How to cascade two text boxes?? How to create runtime drag and drop form builder using asp.net mvc and jquery jsp+ajax validation JQuery-JSP AJAX example not working What is Ajax Framework How to write first example in Ajax? What are Advantages and Disadvantages of AJAX What is Ajax? how to set running watch with descending order in applycation with ajax how to set running watch with descending order in applycation with ajax jsp pages for dispatchaction for adding user to database c++ new, delete, string class using ajax i want to insert data into oracle database how to generate reports from oracle database using jsp and ajax code dynamic creation of multiple drop-down menus Ajax programming tutorials Displaying data from combobox on the web page Displaying data from combobox on the web page Displaying data from combobox on the web page Displaying data from combobox on the web page Displaying data from combobox on the web page What is Java? How to make a ajax application which take data from textarea and that page is not refreshing. how can add new line character into ajax response for java how can add new line character into ajax response for java c# c# asp.net Struts 2 + Ajax bodygaurd java Ajax mew 333 data insertion and fetch 1 my answer what is an ajax call? what is an ajax call? JSF How to easily send and receive recorders from database (in AJAX)? calculating time difference for manually entered in-time and out-time in hours and min for dynamically generated rows in jsp and display in third textfield. how to operate on select box using ajax in struts2? how to operate on select box using ajax in struts2? Auto Search box using ajax Dependant Dropdown Lists AJAX REGISTRATION FORM ajax code for jsp java i want to know how a slide will hide i want to know how a slide will hide

Ads

 
Advertisement null

Ads