0% found this document useful (0 votes)
93 views9 pages

Rapport: Discipline: TWCC Theme

This document summarizes a student project to create a website using ASP.NET and C#. The website includes pages for login, registration, and administration. The login page allows users to enter their username and password. If credentials are valid, the user is redirected to the home page. The registration page collects user information to insert into a database. Finally, the conclusion notes that ASP.NET, C#, and CSS were used to create a basic registration and authentication application.

Uploaded by

Gherman Ion
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views9 pages

Rapport: Discipline: TWCC Theme

This document summarizes a student project to create a website using ASP.NET and C#. The website includes pages for login, registration, and administration. The login page allows users to enter their username and password. If credentials are valid, the user is redirected to the home page. The registration page collects user information to insert into a database. Finally, the conclusion notes that ASP.NET, C#, and CSS were used to create a basic registration and authentication application.

Uploaded by

Gherman Ion
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Universite Technique du Moldova Faculte dOrdinateurs,Informatique et Microelectronique Filiere Francophone Informatique

Rapport
Discipline: TWCC Theme: ASP.NET

Elabore :

par letudiant du groupe FI-101 Turetchi Gheorghe

Verifie:

par le professeur Rusu Viorel

Chisinau 2013

But de travaille : Realisation dun site utilisse le code ASP.NET et C#. Linterface graphique : Login

Registration

Home page:

Admin page:

Login.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="LoginWebSite.Login" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> #login_page { margin-top:140px; }

body { background-image:url(../Images/fon.jpg); } .auto-style1 { text-align: left; } .auto-style2 { width: 100%; } .auto-style3 { width: 94px; } .auto-style4 { width: 94px; height: 23px; text-align: right; } .auto-style5 { height: 23px; } .auto-style6 { height: 23px; width: 201px; } .auto-style7 { width: 201px; } .auto-style8 { width: 94px; text-align: right; } .style1 { width: 559px; height: 23px; text-align: right; } .style2 { text-align: center; } .style3 { height: 23px; width: 443px; } .style4 { width: 443px; } .style6 { width: 559px; height: 30px; } .style7 { width: 559px; text-align: right; } .style8 { width: 559px; height: 20px; } .style9 {

width: 443px; height: 20px; text-align: right; } .style10 { height: 20px; } .style11 { width: 443px; height: 30px; } .style12 { height: 30px; } input.textbox{ border:0; padding:3px; font-size:14px; font-family:Arial, sans-serif; color:#0000FF; border:solid 3px #280000; border-radius:30px; border-color:#DCDCDC #0099FF #0099FF #DCDCDC; } input.textbox:hover{ background-color:##A8A8A8; border-color:#0099FF #DCDCDC #DCDCDC #0099FF; } </style> </head> <body> <div id="login_page"> <form id="form1" runat="server"> <div id="login">

<h3 class="style2">Login Page</h3> <p class="style2"> <asp:Label ID="Label1" runat="server" Visible="False"></asp:Label> </p> </div> <table align="right" class="auto-style2"> <tr> <td class="style1">UserName</td> <td class="style3"> <asp:TextBox ID="TextBox1" class="textbox" runat="server" MaxLength="15" Width="270px"></asp:TextBox> </td> <td class="auto-style5">&nbsp;</td> </tr> <tr> <td class="style7">Password</td> <td class="style4"> <asp:TextBox ID="TextBox2" class="textbox" runat="server" MaxLength="15" TextMode="Password" Width="270px"></asp:TextBox> </td> <td>&nbsp;</td> </tr> <tr> <td class="style6"></td> <td class="style11">

<asp:Button ID="BtnLogin" class="textbox" runat="server" OnClick="BtnLogin_Click" Text="Login" Width="100px" /> </td> <td class="style12"></td> </tr> <tr> <td class="style8"></td> <td class="style9">Nu sunteti inregistrat?Click pentru</td> <td class="style10"> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Registration.aspx">Registration</asp:HyperLink> </td> </tr> </table> </form> </div> </body> </html> protected void BtnLogin_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RegConnectionString"].ConnectionStr ing); con.Open(); string cmdString = "SELECT count(*) FROM Registration WHERE UserName='" + TextBox1.Text + "'"; SqlCommand checkUser = new SqlCommand(cmdString, con); if (temp == 1) { string cmdString2 = "SELECT Password FROM Registration WHERE UserName='" + TextBox1.Text + "'"; SqlCommand pass = new SqlCommand(cmdString2, con); con.Close(); if (password == TextBox2.Text) { Session["New"] = TextBox1.Text; Response.Redirect("Home.aspx"); } else { Label1.Visible = true; Label1.Text = "Invalid password"; } } else { Label1.Visible = true; Label1.Text = "Invalid username"; } }

Registration.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Registration.aspx.cs" Inherits="LoginWebSite.Register" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> body { background-image:url(../Images/fon.jpg); }

.auto-style1 { text-align: center; margin-left: 15px; } .auto-style2 { width: 100%; } .auto-style3 { text-align: right; width: 115px; } .auto-style4 { text-align: right; width: 115px; height: 23px; } .auto-style5 { height: 23px; } .auto-style6 { text-align: right; width: 115px; height: 26px; } .auto-style7 { height: 26px; } .auto-style8 { width: 189px; } .auto-style9 { height: 23px; width: 189px; } .auto-style10 { height: 26px; width: 189px; } .style1 { height: 26px; width: 538px; text-align: left; } .style2 { height: 23px; width: 538px; text-align: left; } .style3 { width: 538px; text-align: left; } .style4 { height: 26px; width: 510px; text-align: right; } .style5 { height: 23px; width: 510px; text-align: right; } .style6 {

width: 510px; text-align: right; } .style7 { width: 538px; text-align: left; } #pagina_inregistrare { margin-top:100px; } input.textbox{ border:0; padding:3px; font-size:14px; font-family:Arial, sans-serif; color:#0000FF; border:solid 3px #280000; border-radius:30px; border-color:#DCDCDC #0099FF #0099FF #DCDCDC; } input.textbox:hover{ background-color:##A8A8A8; border-color:#0099FF #DCDCDC #DCDCDC #0099FF; } #DropDownListCountry { border:0; padding:3px; font-size:14px; font-family:Arial, sans-serif; color:#0000FF; border:solid 3px #280000; border-radius:30px; border-color:#DCDCDC #0099FF #0099FF #DCDCDC; } </style> </head> <body> <div id="pagina_inregistrare"> <form id="form1" runat="server"> <font color="blue"><h2 class="autostyle1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pagina de inregistrare</h2></font> <table class="auto-style2"> <tr> <td class="style4">UserName</td> <td class="style1"> <asp:TextBox ID="TextBoxUN" class="textbox" runat="server" MaxLength="15" Width="180px"></asp:TextBox> </td> <td class="auto-style7"> </td> </tr> <tr> <td class="style5">Password</td> <td class="style2"> <asp:TextBox ID="TextBoxPass" class="textbox" runat="server" MaxLength="15" TextMode="Password" Width="180px"></asp:TextBox> </td> <td class="auto-style5"> </td> </tr> <tr>

<td class="style4">Retype Password</td> <td class="style1"> <asp:TextBox ID="TextBoxRPass" class="textbox" runat="server" MaxLength="15" TextMode="Password" Width="180px"></asp:TextBox> </td> <td class="auto-style7">

</td> </tr> <tr> <td class="style6">Email Address</td> <td class="style7"> <asp:TextBox ID="TextBoxEA" class="textbox" runat="server" MaxLength="50" Width="180px"></asp:TextBox> </td> <td> </td> </tr> <tr> <td class="style4">FullName</td> <td class="style1"> <asp:TextBox ID="TextBoxFN" class="textbox" runat="server" MaxLength="50" Width="180px"></asp:TextBox> </td> <td class="auto-style7"> </td> </tr> <tr> <td class="style6">Country</td> <td class="style7"> <asp:DropDownList class="textbox" ID="DropDownListCountry" runat="server" Height="30px" Width="188px"> <asp:ListItem Selected="True">Select option...</asp:ListItem> <asp:ListItem>India</asp:ListItem> <asp:ListItem>USA</asp:ListItem> <asp:ListItem>Moldova</asp:ListItem> <asp:ListItem>Ukraina</asp:ListItem> <asp:ListItem>Roumania</asp:ListItem> </asp:DropDownList> </td> <td> </td> </tr> <tr> <td class="style6">&nbsp;</td> <td class="style3"> <asp:Button ID="Submit" class="textbox" runat="server" OnClick="Submit_Click" Text="Submit" style="text-align: center" Width="70px" /> &nbsp;&nbsp; </td> <td>&nbsp;</td> </tr> </table> </form> </div> </body> </html>

protected void Submit_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RegConnectionString"].ConnectionStr ing);

con.Open(); string insCmd = "INSERT INTO Registration (UserName, Password, EmailAddress, FullName, Country) VALUES (@UserName, @Password, @EmailAddress, @FullName, @Country)"; SqlCommand insertUser = new SqlCommand(insCmd, con); insertUser.Parameters.AddWithValue("@UserName", TextBoxUN.Text); insertUser.Parameters.AddWithValue("@Password", TextBoxPass.Text); insertUser.Parameters.AddWithValue("@EmailAddress", TextBoxEA.Text); insertUser.Parameters.AddWithValue("@FullName", TextBoxFN.Text); insertUser.Parameters.AddWithValue("@Country", DropDownListCountry.SelectedItem.ToString()); Response.Redirect("Login.aspx"); }

Conclusion : Dans ce travaille de laboratoire jtudie ASP.NET. Aussi jai utilisse le code C# et CSS. Jai realise un petite application pour enregistrer et authentifier sur le system.

You might also like