Welcome
Welcome to CMS n Web. Learn & Study completely Free Articles\Training about Web Designing\Development and CMS.
Search This Web
Saturday, July 6, 2013
Wednesday, July 3, 2013
Simple Registration or Signup & Login or Signin Form using Asp.Net, C#.Net & Sqlserver
Introduction
This article explains about creating a simple registration or signup and login or sign in form using asp.net, c#.net and sqlserver.
Follow the steps as described below to create the registration form and login form as shown above.
Creating Database:
- Create a databse in sqlserver with name 'TestDB'
- Next create a table with fields as shown in picture.
Creating Registration or signup form:
- Now create a new website using visual studio 2008 0r 2010.
- Design the registraion form and login form as shown in Below pictures. In these two forms, validation controls are used to validate the fields as per requirement. To know about validation controls in asp.net read the following article.
- Add connection string property in web.config file as shown below.
<configuration> <connectionStrings> <add name="CM_Connection" connectionString="data source=localhost;Initial Catalog=TestDB;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/> </connectionStrings> <system.web>
Note:In this web.config file, the connection string name is 'CM_Connection'. You can change data source to your local server name (here it is localhost).- Next in the 'CreateUser' button click event write the following code.
if (Page.IsValid) { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["CM_Connection"].ConnectionString)) { SqlCommand cmd = new SqlCommand(); Guid guid; guid = Guid.NewGuid(); string sql = "INSERT INTO TestDB_RegisterUser (registeruser_id,registeruser_username,registeruser_email,registeruser_password"; sql += " ,registeruser_createdon,registeruser_modifiedon,registeruser_rowstate)"; sql += "VALUES (@ID,@Username,@Email,@Password,@Createdon,@Modifiedon,@Rowstate)"; cmd.Parameters.AddWithValue("@ID", guid); cmd.Parameters.AddWithValue("@Username", UserName.Text.Trim()); cmd.Parameters.AddWithValue("@Email", Email.Text.Trim()); cmd.Parameters.AddWithValue("@Password", Password.Text); cmd.Parameters.AddWithValue("@Createdon", DateTime.Now); cmd.Parameters.AddWithValue("@Modifiedon", DateTime.Now); cmd.Parameters.AddWithValue("@Rowstate", 1); cmd.Connection = con; cmd.CommandText = sql; con.Open(); try { cmd.ExecuteNonQuery(); ErrorMessage.Text = "Registered successfully."; } catch(Exception ex) { throw new Exception(ex.Message); } } }
Note: You can check the validity of a Page by checking the Page.IsValid property. For this property to return true, all validation server controls in the current validation group must validate successfully. You should check this property only after you have called the Page.Validate method, or set the CausesValidation property to true in the OnServerClick event handler for an ASP.NET server control that initiates form processing. In simple words the Page.IsValid property tells you whether the validation succeeded or not.
Creating Signin or Login form: In the 'Log In' button click event write the code as shown below.
The above method gets the record that matches with useremail and password. Otherwise the datatable will be empty which is used to show 'Invalid username or password' to the user.stringemail = UserName.Text.Trim(); string pwd = Password.Text; DataTable dt = new DataTable(); using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["CM_Connection"].ConnectionString)) { SqlCommand cmd = new SqlCommand(); cmd.Connection = con; // cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "SELECT registeruser_id,registeruser_username, registeruser_email,registeruser_password FROM TestDB_RegisterUser where registeruser_email='" + email + "' and registeruser_password='" + pwd + "' and registeruser_rowstate<3 "; con.Open(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; da.Fill(dt); if (dt.Rows.Count > 0) { Session.Add("UserID", dt.Rows[0][0].ToString()); Session.Add("Username", dt.Rows[0][1].ToString()); Session.Add("UserEmail", dt.Rows[0][2].ToString()); Response.Redirect("~/Default.aspx", false); } else { FailureText.Text = "Invalid username or password"; } }
Thus you can create a registration form and log in form using asp.net
Source Code can be download from here : - Next in the 'CreateUser' button click event write the following code.
- Add connection string property in web.config file as shown below.
Labels:
Asp.net
Saturday, June 29, 2013
Outstanding ASP.NET Resources
Body:
Tools
ASP.NET MVC
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and that gives you full control over markup for enjoyable, agile development. check it out
Glimpse
What Firebug is for the client, Glimpse does for the server... in other words, a client side Glimpse into whats going on in your server. check it out
Composite
Composite is a free and open source content management system based on the Microsoft .NET 4 platform. check it out
Webmatrix
WebMatrix is a free web development tool from Microsoft that includes everything you need for website development. Start from open source web applications, built-in web templates or just start writing code yourself.check it out
LiveUI
LiveUI is a Framework for creating Rich Internet Applications. Basic principle behind LiveUI is that application logic should not depend of presentation layer. check it out
DotNetNuke
DotNetNuke is the leading Web Content Management Platform (or CMS) for Microsoft ASP.NET, powering over 600,000 production web sites worldwide. check it out
DotNetSlackers
DotNetSlackers, provides you with the latest .NET news and articles, free blogs to express yourself about .NET and active forums to ask for or give help. check it out
Books
Ultra-Fast ASP.NET: Build Ultra-Fast and Ultra-Scalable web sites using ASP.NET and SQL Server
Ultra-fast ASP.NET provides a practical guide to building extremely fast and scalable websites using ASP.NET and SQL Server. Written by a highly-experienced consultant it provides straight-forward guidance for achieving performance increases through clearly delimited alterations to website’s design and coding. The book deals with all aspects of website performance from client computer to the website code to the supporting IIS and SQL Servers that underpin it. This gives readers all the information that they need in a single volume.
ASP.NET 4 Unleashed
The most comprehensive book on Microsoft’s new ASP.NET 4, ASP.NET 4 Unleashed covers all facets of ASP.NET development. Led by Microsoft ASP.NET program manager Stephen Walther, an expert author team thoroughly covers the entire platform. The authors first introduce the ASP.NET Framework’s basic controls and show how to create common site-wide layouts and styles. Next, they cover all aspects of accessing, presenting, organizing, and editing data. You’ll find thorough and practical sections on building custom components and controls, providing effective site navigation, securing sites and applications, and much more. This book presents hundreds of realistic code examples, reflecting the authors’ unsurpassed experience with ASP.NET both inside and outside Microsoft.
Beginning ASP.NET 4: in C# and VB (Wrox Programmer to Programmer)
This book is for anyone who wants to learn how to build rich and interactive web sites that run on the Microsoft platform. With the knowledge you gain from this book, you create a great foundation to build any type of web site, ranging from simple hobby-related web sites to sites you may be creating for commercial purposes. Anyone new to web programming should be able to follow along because no prior background in web development is assumed although it helps if you do have a basic understanding of HTML and the web in general. The book starts at the very beginning of web development by showing you how to obtain and install Visual Web Developer. The chapters that follow gradually introduce you to new technologies, building on top of the knowledge gained in the previous chapters.
Podcasts
ASP.NET - Podcasts
This course covers introduction to ASP.NET, creating Social Networking, and ECommerce sites using ASP.NET.check it out
Server Side Scripting (ASP.NET)
Web Programming Using Server-Side Script is design to educate students in the constructions of Web pages which require processing on the server. Uses ASP.NET check it out
The ASP.NET Podcast
Wallace B. (Wally) McClure presents interviews and short technical talks on .NET Technologies. check it out
World of .NET
The World of .NET show is an audio podcast covering practical .NET enterprise application development. check it out
ref:
Stefan Nistor
Marketing Specialist
Labels:
Asp.net
Friday, March 1, 2013
Generate a Report using Crystal Reports in Visual Studio 2010
By Tarun Dudhatra, 8 Jun 2011
Labels:
Asp.net,
Crystal Reports
Subscribe to:
Posts (Atom)


