我的登錄頁面控件代碼:編寫代碼一
<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>
我的按鈕登錄Click事件是:
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!";
}
}
}
我的問題是如何使餅乾,如何編寫代碼對於c#中的loginStatus,請使用一些代碼來實現,謝謝。
謝謝你的幫助,我會檢查它:) – VINNUSAURUS 2013-03-27 14:01:00