我的登录页面控件代码是:
<table class="auto-style9">
<tr>
<td class="auto-style12" colspan="2" style="font-family:
Georgia; font-size: medium; font-weight: bold;
text-transform: uppercase; color: #000000">Login
</td>
</tr>
<tr>
<td class="auto-style15">User name</td>
<td class="auto-style15">
<asp:TextBox ID="UserNameTextBox" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style15">Password </td>
<td class="auto-style15">
<asp:TextBox ID="PasswordTextBox" runat="server" TextMode="Password">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style15"> </td>
<td class="auto-style15">
<asp:Button ID="ButtonLogin" runat="server"
CommandName="Login" Text="Login!"
OnClick="ButtonLogin_Click" BackColor="Black"
ForeColor="Yellow" />
</td>
</tr>
</table>
我的按钮登录点击事件是:
protected void ButtonLogin_Click(object sender, EventArgs e)
{
using(BerouDataContext Data = new BerouDataContext())
{
var UsernameCheck = UserNameTextBox.Text;
var PasswordCheck = PasswordTextBox.Text;
var UserExist = Data.Memberships.Single(s => s.Username == UsernameCheck);
if (UserExist == null || UserExist.Password != PasswordCheck)
{
LabelLoginValidity.Text = "Login Details are incorrect.";
}
else
{
LabelLoginValidity.Text = "Login Successfull!";
}
}
}
我的问题是如何制作cookie,如何在c#中为loginStatus编写代码,请帮助一些代码来实现,谢谢。