Thursday, February 20, 2014

Login

//login.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="SkyShuttleRide.Login" Title="SkyShuttleRide Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">


    <title></title>
    <link rel="Stylesheet" href="../Styles/SkyReservation.css" />
</head>
<body>
    <form id="form1" runat="server">
    <br />
    <br />
    <div id="formdiv" style="width:200px;">
   
        <asp:Login ID="Login1" runat="server" onauthenticate="Login1_Authenticate"
            BackColor="#E3EAEB" BorderColor="#E6E2D8" BorderPadding="4" BorderStyle="Solid"
            BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333"
            TextLayout="TextOnTop">
            <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
            <LoginButtonStyle BackColor="White" BorderColor="#C5BBAF" BorderStyle="Solid"
                BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#1C5E55" />
            <TextBoxStyle Font-Size="0.8em" />
            <TitleTextStyle BackColor="#1C5E55" Font-Bold="True" Font-Size="0.9em"
                ForeColor="White" />
        </asp:Login>
   
    </div>
    </form>
</body>
</html>


//login.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace SkyShuttleRide
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            if (Membership.ValidateUser(Login1.UserName, Login1.Password) == true)
            {
                Login1.Visible = true;
                Session["user"] = User.Identity.Name;
                FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false);
                Response.Redirect("Admin/UpdateReservation.aspx");
            }
            else
            {
                Response.Write("Invalid Login");
            }
        }
    }
}

0 comments:

Post a Comment

Popular Posts

Recent Posts

Text Widget

Powered by Blogger.

Find Us On Facebook

Flickr Images

Recent Posts

Video Of Day

Random Posts

Facebook

Random Posts

Advertising

Popular Posts